Browse Source

完善 提现成功 功能

feature/feature-compatible
fengchengzhi 7 years ago
parent
commit
805a6c273a
4 changed files with 120 additions and 84 deletions
  1. 2
      src/router/index.js
  2. 27
      src/view/put-money-success.vue
  3. 163
      src/view/put-money.vue
  4. 12
      src/view/service-evaluation.vue

2
src/router/index.js

@ -29,7 +29,7 @@ let router = new Router({
{
path: '/put-money-success',
name: '提现成功',
component: putMoneySuccess
component: putMoneySuccess,
},
{
path: '/service-evaluation',

27
src/view/put-money-success.vue

@ -13,7 +13,7 @@
<span>1-3个工作日</span>
</div>
<div class="money-news">
<p>提现金额 <span>800</span></p>
<p>提现金额 <span>{{amount}}</span></p>
</div>
</div>
<button class="goHome">返回首页</button>
@ -24,14 +24,33 @@
<script>
export default{
data () {
return {
amount: 0
}
},
created(){
this.getParams()
},
methods:{
//
goBack() {
history.go(-1)
},
getParams () {
//
this.amount = this.$route.params.amount
console.log(this.$route.params)
console.log(this.amount)
}
},
mounted() {
//this.isWeixin ()
}
mounted() {
console.log(this.$route)
},
watch: {
// ,
'$route': 'getParams'
}
}
</script>

163
src/view/put-money.vue

@ -39,79 +39,96 @@
</template>
<script>
import putMoney from "../models/put-money-model.js";
import { Alert,Toast } from 'vux'
import configs from '../configs';
var locationUrl = configs.locationUrl;
export default{
data() {
return {
//
inputCue : '(请输入整数金额)',
//
isActive:false,
inputVal: null,
//
currentAmount: 0,
}
},
components: {
Toast,
},
watch:{
//
inputVal: function (val) {
var rule = /^[1-9]\d*$/;
if (!rule.test(val)) {
this.inputCue = '( 请输入正整数金额!)'
this.inputVal = ''
this.isActive = false
return
}else {
this.isActive = true;
this.inputCue = ''
}
import putMoney from "../models/put-money-model.js";
import { Alert, Toast } from "vux";
import configs from "../configs";
var locationUrl = configs.locationUrl;
export default {
data() {
return {
//
inputCue: "(请输入整数金额)",
//
isActive: false,
inputVal: null,
//
currentAmount: 0
};
},
components: {
Toast
},
watch: {
//
inputVal: function(val) {
var rule = /^[1-9]\d*$/;
if (!rule.test(val)) {
this.inputCue = "( 请输入正整数金额!)";
this.inputVal = "";
this.isActive = false;
return;
} else {
this.isActive = true;
this.inputCue = "";
}
}
},
methods: {
//
submit() {
if (this.isActive) {
this.$router.push({
name: "提现成功",
params: { amount: this.inputVal }
});
return;
//
var ua = navigator.userAgent.toLowerCase();
if (!ua.match(/MicroMessenger/i) == "micromessenger") {
this.$vux.toast.text("请登录微信进行操作", "middle");
return;
}
putMoney.putMoney({ amount: this.inputVal * 100 }).then(res => {
if (res.code == 0) {
this.$router.push({
name: "提现成功",
params: { amount: this.inputVal }
});
} else if (res.code == 666) {
this.$vux.toast.text(res.msg, "middle");
setTimeout(function() {
window.location.href =
locationUrl +
"/mall/web/user/login?callback=" +
encodeURIComponent(window.location.href);
}, 1000);
} else {
this.$vux.toast.text(res.msg, "middle");
}
},
methods:{
//
submit() {
if(this.isActive) {
putMoney.putMoney(
{amount:this.inputVal*100}
).then(res => {
if (res.code == 0){
this.$router.push({path:'/put-money-success'});
} else if (res.code == 666) {
this.$vux.toast.text(res.msg,'middle')
setTimeout(function () {
window.location.href = locationUrl + '/mall/web/user/login?callback=' + encodeURIComponent(window.location.href);
}, 1000);
} else {
this.$vux.toast.text(res.msg,'middle')
}
// this.$vux.toast.text(res)
})
}
},
//
goBack() {
history.go(-1)
},
//
getParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var url = window.location.href
url = window.location.href.substring(url.indexOf('?')+1,url.length)
var r = url.match(reg);
if (r != null) return unescape(r[2]);
return null;
}
},
mounted() {
//
this.currentAmount = (this.getParam("currentAmount")/100).toFixed(2)
//this.$vux.toast.text(this.currentAmount,'middle')
}
// this.$vux.toast.text(res)
});
}
},
//
goBack() {
history.go(-1);
},
//
getParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var url = window.location.href;
url = window.location.href.substring(url.indexOf("?") + 1, url.length);
var r = url.match(reg);
if (r != null) return unescape(r[2]);
return null;
}
},
mounted() {
//
this.currentAmount = (this.getParam("currentAmount") / 100).toFixed(2);
//this.$vux.toast.text(this.currentAmount,'middle')
}
};
</script>

12
src/view/service-evaluation.vue

@ -135,14 +135,14 @@ export default {
var cookieName = "1hjz_mall_login_access_token=";
var token = strCookie.slice(cookieName.length);
model
model
.add(
{
timeScore: this.timeScore,
serviceScore: this.serviceScore,
professionScore: this.professionScore,
content: this.content,
bookNo: this.getParam("bookNo")
timeScore: this.timeScore,
serviceScore: this.serviceScore,
professionScore: this.professionScore,
content: this.content,
bookNo: this.getParam("bookNo")
},
token
)

Loading…
Cancel
Save