|
|
|
@ -26,15 +26,15 @@ |
|
|
|
<view class="cu-bar padding-lr"> |
|
|
|
<text class="lf-color-555 lf-font-28">优惠</text> |
|
|
|
<view v-if="goods_details.coupon != ''"> |
|
|
|
<text class="lf-color-price lf-font-28 lf-m-r-10" v-for="(item,index) of goods_details.coupon">{{item.tag}}</text> |
|
|
|
<text class="lf-color-price lf-font-28 lf-m-l-10" v-for="(item,index) of goods_details.coupon">{{item.tag}}</text> |
|
|
|
</view> |
|
|
|
<view v-else> |
|
|
|
<text class="lf-color-price lf-font-28 lf-m-r-10">暂无优惠</text> |
|
|
|
<text class="lf-color-price lf-font-28 lf-m-l-10">暂无优惠</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<self-line/> |
|
|
|
<view class="bg-white" v-if="btn_type!=2"> |
|
|
|
<view class="bg-white" v-if="enter_type!=1"> |
|
|
|
<view class="cu-bar padding-lr solid-bottom"> |
|
|
|
<text class="lf-color-555 lf-font-28">联系人</text> |
|
|
|
<input type="text" v-model="contact" class="lf-color-999 lf-font-28 lf-text-right" placeholder="请输入联系人" /> |
|
|
|
@ -45,7 +45,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<self-line/> |
|
|
|
<view class="bg-white" v-if="btn_type!=2"> |
|
|
|
<view class="bg-white" v-if="enter_type!=1"> |
|
|
|
<view class="lf-p-t-30 lf-p-l-32 lf-p-b-36"> |
|
|
|
<view class="lf-font-28 lf-color-555">支付方式</view> |
|
|
|
</view> |
|
|
|
@ -106,15 +106,23 @@ |
|
|
|
contact: '', |
|
|
|
phone: '', |
|
|
|
pay_type: 0, |
|
|
|
btn_type: 1 |
|
|
|
btn_type: 1, |
|
|
|
ifPay: true, |
|
|
|
order_id: 0, |
|
|
|
enter_type: 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(e) { |
|
|
|
this.goods_id = e.goods_id; |
|
|
|
this.btn_type = e.btn_type |
|
|
|
this.btn_type = e.btn_type; |
|
|
|
this.order_id = e.order_id; |
|
|
|
this.enter_type = e.enter_type; |
|
|
|
if(this.goods_id) { |
|
|
|
this.getGoodsData(this.pay_type); |
|
|
|
} |
|
|
|
if(this.order_id && this.enter_type == 1) { |
|
|
|
this.payOnce(); |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
payStatus(type) { |
|
|
|
@ -141,9 +149,48 @@ |
|
|
|
this.$msg('请输入联系电话!'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if(!this.ifPay) return; |
|
|
|
this.ifPay = false; |
|
|
|
this.$http(this.API.API_CREATEORDER,{id: this.goods_id,num: 1,pay_type: this.pay_type,name:this.contact,mobile:this.phone}).then(res => { |
|
|
|
console.log(res); |
|
|
|
this.order_id = res.data.id |
|
|
|
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.ifPay = true |
|
|
|
this.$url('/pages/payState/paystate?ifSuccess=1&order_id='+this.order_id,{type: 'redirect'}) |
|
|
|
}, |
|
|
|
fail: (err) => { |
|
|
|
this.ifPay = true |
|
|
|
this.$url('/pages/payState/paystate?ifSuccess=2&order_id='+this.order_id,{type: 'redirect'}) |
|
|
|
}, |
|
|
|
}) |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
this.ifPay = true |
|
|
|
}) |
|
|
|
}, |
|
|
|
payOnce() { |
|
|
|
this.$http(this.API.API_ORDERPAY,{id: this.order_id}).then(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.$url('/pages/payState/paystate?ifSuccess=1&order_id='+this.order_id,{type: 'redirect'}) |
|
|
|
}, |
|
|
|
fail: (err) => { |
|
|
|
this.$url('/pages/payState/paystate?ifSuccess=2&order_id='+this.order_id,{type: 'redirect'}) |
|
|
|
}, |
|
|
|
}) |
|
|
|
}).catch(err => {}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|