Browse Source

订单确认页面对接

master
邓平艺 4 years ago
parent
commit
76fd8e4615
  1. 27
      pages/login/index.vue
  2. 53
      pages/order/confirm-order.vue
  3. 2
      pages/order/index.vue

27
pages/login/index.vue

@ -23,17 +23,17 @@
</block> </block>
</view> </view>
<!-- 服务条款 --> <!-- 服务条款 -->
<view class="fixed-bottom">
<view class="fixed-bottom" v-show="agreement.title">
<checkbox-group @change="checkboxChange" style="display: inline-block;"> <checkbox-group @change="checkboxChange" style="display: inline-block;">
<checkbox class="lf-text-vertical" :checked="checked"></checkbox> <checkbox class="lf-text-vertical" :checked="checked"></checkbox>
</checkbox-group> </checkbox-group>
<text class="lf-m-l-10 lf-font-24 lf-color-gray">
<text>请认真阅读并同意</text>
<text class="highlight" @click="enterAgree">时空网协议</text>
<text>在小程序下单购买即表示您已默认同意</text>
<text class="highlight" @click="enterAgree">时空网协议</text>
<text>的所有条款</text>
</text>
<view class="lf-m-l-10 lf-font-24 lf-color-gray lf-flex">
<view>请认真阅读并同意</view>
<view class="highlight" @click="enterAgree">{{ agreement.title }}</view>
<view>在小程序下单购买即表示您已默认同意</view>
<view class="highlight" @click="enterAgree">{{ agreement.title }}</view>
<view>的所有条款</view>
</view>
</view> </view>
</view> </view>
</template> </template>
@ -46,19 +46,26 @@
isLogin: false, // isLogin: false, //
userInfo: {}, userInfo: {},
type: 'userinfo', // phone | userinfo type: 'userinfo', // phone | userinfo
agreement: {} //
} }
}, },
onLoad(options){ onLoad(options){
this.type = options.type || this.type; this.type = options.type || this.type;
this.getAgree();
getApp().globalData.wxlogin().then(res => { getApp().globalData.wxlogin().then(res => {
this.userInfo = res; this.userInfo = res;
}); });
}, },
methods: { methods: {
//
getAgree(){
this.$http(this.API.API_WXLOGIN_VIEW).then(res => {
this.agreement = res.data.agreement;
})
},
// //
enterAgree(){ enterAgree(){
console.log("查看协议");
this.$url('/pages/agreement/agreement');
this.$url('/pages/agreement/agreement?id='+ this.agreement.article_id);
}, },
// //
checkboxChange(event){ checkboxChange(event){

53
pages/order/confirm-order.vue

@ -94,7 +94,9 @@
goods_specs_id: 1, goods_specs_id: 1,
orderDetails: {}, orderDetails: {},
ifchoose: true, ifchoose: true,
ifCheck: true
ifCheck: true,
type: 0,
order_id: 0
} }
}, },
computed: { computed: {
@ -108,7 +110,9 @@
} }
}, },
onLoad(e) { onLoad(e) {
this.goods_id = e.goods_id
this.type = e.type;
this.goods_id = e.goods_id;
this.order_id = e.order_id;
this.goods_specs_id = e.goods_specs_id this.goods_specs_id = e.goods_specs_id
}, },
methods: { methods: {
@ -117,16 +121,16 @@
if(res.code == 0) { if(res.code == 0) {
this.orderDetails = res.data this.orderDetails = res.data
this.skeletonLoading = false this.skeletonLoading = false
if( Object.keys(res.metal_data).length != 0 ) {
this.ifCheck = false
}else {
this.ifCheck = true
}
this.ifCheck = false
}else { }else {
this.$msg(res.msg) this.$msg(res.msg)
} }
}).catch(err => { }).catch(err => {
// this.mescroll.endErr();
if(res.code == 9999) {
this.ifCheck = true
}else {
this.ifCheck = false
}
}); });
}, },
reduce() { reduce() {
@ -151,7 +155,7 @@
}, },
submit(){ submit(){
if(this.ifchoose == true) { if(this.ifchoose == true) {
if(this.ifCheck == false) {
if(this.ifCheck == true) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '是否同意前往手机授权?', content: '是否同意前往手机授权?',
@ -161,11 +165,14 @@
} }
}); });
}else { }else {
if(this.type == 1){
this.pay();
return;
}
this.$http(this.API.API_PRPAID, { this.$http(this.API.API_PRPAID, {
goods_id: this.goods_id, goods_id: this.goods_id,
goods_specs_id: this.goods_specs_id, goods_specs_id: this.goods_specs_id,
number: this.num, number: this.num,
token: 'fdf12000e774e48bc60c6b6d42055602'
}).then(res => { }).then(res => {
console.log(res) console.log(res)
uni.requestPayment({ uni.requestPayment({
@ -175,10 +182,10 @@
package: res.data.package, package: res.data.package,
signType: res.data.signType, signType: res.data.signType,
paySign: res.data.paySign, paySign: res.data.paySign,
success: function (res) {
success: (res) => {
this.$routerGo('/pages/order/pay-success?ifSuccess='+1) this.$routerGo('/pages/order/pay-success?ifSuccess='+1)
}, },
fail: function (err) {
fail: (err) => {
this.$routerGo('/pages/order/pay-success?ifSuccess='+2) this.$routerGo('/pages/order/pay-success?ifSuccess='+2)
} }
}) })
@ -191,12 +198,32 @@
return return
} }
}, },
pay(){
console.log("this.order_id", this.order_id)
this.$http(this.API.API_PAYMENT_DIRECT, {order_id: this.order_id}).then(res => {
console.log("res")
uni.requestPayment({
orderInfo: res.data.order_num,
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success: (res) => {
this.$routerGo('/pages/order/pay-success?ifSuccess='+1)
},
fail: (err) => {
this.$routerGo('/pages/order/pay-success?ifSuccess='+2)
}
})
})
},
// //
downCallback() { downCallback() {
this.getConfirmOrder() this.getConfirmOrder()
}, },
}, },
created() {
onShow() {
this.getConfirmOrder() this.getConfirmOrder()
} }
} }

2
pages/order/index.vue

@ -23,7 +23,7 @@
<text class="lf-font-24"></text> <text class="lf-font-24"></text>
<text class="lf-font-42">{{item.selling_price}}</text> <text class="lf-font-42">{{item.selling_price}}</text>
</text> </text>
<button v-if="item.state==1" @tap.stop="$routerGo('/pages/order/confirm-order?goods_id='+item.goods_id+'&goods_specs_id='+item.goods_specs_id)">立即付款</button>
<button v-if="item.state==1" @tap.stop="$routerGo('/pages/order/confirm-order?type=1&goods_id='+item.goods_id+'&goods_specs_id='+item.goods_specs_id +'&order_id='+ item.id)">立即付款</button>
<button v-if="item.state==2" class="cu-btn bg-green round margin-left-sm" @tap="$routerGo('/pages/order/order-details?orderid='+item.id)">立即使用</button> <button v-if="item.state==2" class="cu-btn bg-green round margin-left-sm" @tap="$routerGo('/pages/order/order-details?orderid='+item.id)">立即使用</button>
</view> </view>
</view> </view>

Loading…
Cancel
Save