|
@@ -156,6 +156,7 @@ export default {
|
|
|
addressData: {
|
|
|
|
|
|
},
|
|
|
+ runing:false,
|
|
|
|
|
|
show: false,
|
|
|
message: '',
|
|
@@ -329,130 +330,44 @@ export default {
|
|
|
// }
|
|
|
// })
|
|
|
// },
|
|
|
- confirm() {
|
|
|
+ async confirm() {
|
|
|
// 确认订单
|
|
|
var that = this;
|
|
|
- var info = that.info;
|
|
|
-
|
|
|
- if (running) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- info.address = that.address; // var shipping = info.shipping;
|
|
|
-
|
|
|
- var receive_type = that.receive_type; //2邮寄 1核销
|
|
|
-
|
|
|
- const pay_type = info.freight || info.price ? 2 : 1; // var new_data = { 'sku_key': this.data.sku_key,'goods_id': info.id, 'uid': app.getCache('userinfo').uid, 'receive_type': shipping, 'freight': info.freight, 'pay_type': pay_type, 'pay_money': info.price + info.freight, 'user_mark': that.data.message, 'integral': info.integral, 'good_info': info.good_info, 'goods_name': info.title, 'integral_money': info.price };
|
|
|
-
|
|
|
- var new_data = {
|
|
|
- sku_key: this.sku_key,
|
|
|
- goods_id: info.id,
|
|
|
- uid: app.globalData.getCache('userinfo').uid,
|
|
|
- receive_type: receive_type,
|
|
|
- user_mark: that.message
|
|
|
- };
|
|
|
-
|
|
|
- if (receive_type == 2) {
|
|
|
- console.log(info.address);
|
|
|
-
|
|
|
- if (info.address.phone) {
|
|
|
- new_data['receiver_mobile'] = info.address.phone;
|
|
|
- } else {
|
|
|
- new_data['receiver_mobile'] = '';
|
|
|
- }
|
|
|
-
|
|
|
- new_data['receiver_area'] = info.address.province + info.address.city + info.address.district;
|
|
|
- new_data['receiver_address'] = info.address.address;
|
|
|
- new_data['receiver_name'] = info.address.consigner;
|
|
|
-
|
|
|
- if (!new_data.receiver_mobile || !new_data.receiver_area || !new_data.receiver_address || !new_data.receiver_name) {
|
|
|
- a.alert('请选择收货地址');
|
|
|
- return;
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (receive_type == 1) {
|
|
|
- new_data['receiver_mobile'] = that.phone;
|
|
|
-
|
|
|
- if (!new_data.receiver_mobile) {
|
|
|
- a.alert('填写手机号码');
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- running = true;
|
|
|
- console.log(new_data);
|
|
|
- a.post('regionintegral/createOrder', new_data, function (t) {
|
|
|
- // 年前的支付流程
|
|
|
- running = false;
|
|
|
-
|
|
|
- if (t.code == 0) {
|
|
|
- if (t.info == 0) {
|
|
|
- a.success('兑换成功');
|
|
|
- setTimeout(function () {
|
|
|
- uni.reLaunch({
|
|
|
- url: '/pages/operate/logs/logs'
|
|
|
- });
|
|
|
- }, 1500);
|
|
|
- } else {
|
|
|
- that.toPay(t.info);
|
|
|
- }
|
|
|
- } else {
|
|
|
- a.toast(t.msg, 'none');
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- toPay: function (order_id) {
|
|
|
- let that = this;
|
|
|
- a.get(
|
|
|
- 'pay/addintegralpay',
|
|
|
- {
|
|
|
- order_id: order_id,
|
|
|
- order_type: 'region_integral'
|
|
|
- },
|
|
|
- function (t) {
|
|
|
- if (t.code == 0) {
|
|
|
- uni.requestPayment({
|
|
|
- timeStamp: t.info.timeStamp,
|
|
|
- nonceStr: t.info.nonceStr,
|
|
|
- package: t.info.package,
|
|
|
- signType: t.info.signType,
|
|
|
- paySign: t.info.paySign,
|
|
|
- success: function (res) {
|
|
|
- console.log(res);
|
|
|
-
|
|
|
- if (res.errMsg == 'requestPayment:ok') {
|
|
|
- a.success('支付成功');
|
|
|
- setTimeout(function () {
|
|
|
- uni.reLaunch({
|
|
|
- url: '/pages/operate/logs/logs'
|
|
|
- });
|
|
|
- }, 1500);
|
|
|
- } else {
|
|
|
- a.error('支付失败!');
|
|
|
- }
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- getApp().globalData.yidu.msg('机不可失,不要让宝贝等太久哦');
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- if (t.code == 2) {
|
|
|
- a.success('支付成功');
|
|
|
- setTimeout(function () {
|
|
|
- uni.reLaunch({
|
|
|
- url: '/pages/operate/logs/logs'
|
|
|
- });
|
|
|
- }, 1500);
|
|
|
- } else {
|
|
|
- a.alert(t.msg);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- );
|
|
|
+
|
|
|
+ var id = this.id;
|
|
|
+
|
|
|
+ var addressId = this.addressData.id||''
|
|
|
+
|
|
|
+ if(!addressId){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请先选择收货地址!',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.runing){
|
|
|
+ }
|
|
|
+
|
|
|
+ this.runing = true
|
|
|
+
|
|
|
+ let data = await this.$api.request('/order/createIntegral','POST',{
|
|
|
+ id,
|
|
|
+ addressId
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ this.runing = false
|
|
|
+
|
|
|
+ console.log(data)
|
|
|
+ if(data){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
+
|
|
|
selectAddress() {
|
|
|
// 选择收货地址
|
|
|
const that = this;
|