Fix(订单):[#3256]商详页直接进入提交订单页面,默认地址显示为上一次购买商品时选择的地址信息
This commit is contained in:
@@ -3,6 +3,14 @@
|
||||
* */
|
||||
import request from "@/utils/request";
|
||||
|
||||
/**
|
||||
* 获取默认地址
|
||||
* @returns {*}
|
||||
*/
|
||||
export function getAddressDefaultSelected() {
|
||||
return request.get("/address/defaultSelected")
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过购物车 id 获取订单信息
|
||||
* @param cartId
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
<template>
|
||||
<view class="order-submission" style="padding: 30rpx;">
|
||||
<view class="allAddress" style="background-color: #f6f6f6;">
|
||||
|
||||
<view
|
||||
class="address acea-row v12-align-start"
|
||||
style="flex-wrap: nowrap;margin: 0 0 30rpx 0;border-radius: 16rpx;"
|
||||
v-if="shipping_type === 0"
|
||||
@click="addressTap"
|
||||
v-if="shipping_type === 0"
|
||||
class="address acea-row v12-align-start"
|
||||
style="flex-wrap: nowrap;margin: 0 0 30rpx 0;border-radius: 16rpx;"
|
||||
@click="addressTap"
|
||||
>
|
||||
<image style="flex-shrink: 0;width: 36rpx;height: 36rpx;margin-right: 20rpx;"
|
||||
:src="webUrl+'/orderIcon/map.png'" mode=""></image>
|
||||
<image
|
||||
:src="webUrl+'/orderIcon/map.png'"
|
||||
style="flex-shrink: 0;width: 36rpx;height: 36rpx;margin-right: 20rpx;"
|
||||
/>
|
||||
<view class="acea-row row-between-wrapper" style="flex-wrap: nowrap;flex-grow: 1;">
|
||||
<view class="addressCon" v-if="addressInfo.realName">
|
||||
<view class="more-t">
|
||||
@@ -25,32 +26,35 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<div style="flex-wrap: nowrap;" class="address acea-row row-middle" v-else @click="showStoreList">
|
||||
|
||||
<image style="flex-shrink: 0;width: 48rpx;height: 48rpx;margin-right: 20rpx;"
|
||||
:src="webUrl+'/20230304135530688212.png'" mode=""></image>
|
||||
<div
|
||||
v-else
|
||||
style="flex-wrap: nowrap;"
|
||||
class="address acea-row row-middle"
|
||||
@click="showStoreList"
|
||||
>
|
||||
<image
|
||||
:src="webUrl+'/20230304135530688212.png'"
|
||||
style="flex-shrink: 0;width: 48rpx;height: 48rpx;margin-right: 20rpx;"
|
||||
/>
|
||||
<view class="acea-row row-between-wrapper" style="flex-wrap: nowrap;flex-grow: 1;">
|
||||
<div class="addressCon">
|
||||
<div class="name">
|
||||
{{ isNullOrEmpty(storeItems) ? systemStore.name : storeItems.name }}
|
||||
<span
|
||||
class="phone"
|
||||
>{{ isNullOrEmpty(storeItems) ? systemStore.phone : storeItems.phone }}</span>
|
||||
<span class="phone">{{ isNullOrEmpty(storeItems) ? systemStore.phone : storeItems.phone }}</span>
|
||||
</div>
|
||||
<div>{{ isNullOrEmpty(storeItems) ? systemStore.address : storeItems.address }}</div>
|
||||
</div>
|
||||
<div class="iconfont icon-jiantou"></div>
|
||||
</view>
|
||||
|
||||
</div>
|
||||
</view>
|
||||
|
||||
<OrderGoods :evaluate="0" :cartInfo="orderGroupInfo.cartInfo" title="商品信息"></OrderGoods>
|
||||
|
||||
<OrderGoods
|
||||
:evaluate="0"
|
||||
:cartInfo="orderGroupInfo.cartInfo"
|
||||
title="商品信息"
|
||||
/>
|
||||
<view class="wrapper" style="margin:0;border-radius:0 0 20rpx 20rpx">
|
||||
|
||||
|
||||
<view class="v12-pa-2 acea-row row-between-wrapper" style="flex-wrap: nowrap;" v-if="shipping_type === 0">
|
||||
<view v-if="shipping_type === 0" class="v12-pa-2 acea-row row-between-wrapper" style="flex-wrap: nowrap;">
|
||||
<view class="acea-row row-middle" style="flex-wrap: nowrap;">
|
||||
<!-- <image style="width: 32rpx;height: 32rpx;margin-right: 12rpx;" :src="webUrl+'/20210807230820761721.png'"
|
||||
mode=""></image> -->
|
||||
@@ -64,13 +68,22 @@
|
||||
<view class="v12-pa-2 acea-row row-between-wrapper">
|
||||
<view class="v12-font-24 v12-secondary-dark-text v12-pr-3 v12-text-right" style="width: 140rpx">联系人</view>
|
||||
<view class="discount">
|
||||
<input class="v12-font-24" type="text" placeholder="请填写您的联系姓名" v-model="contacts"/>
|
||||
<input
|
||||
v-model="contacts"
|
||||
class="v12-font-24"
|
||||
type="text"
|
||||
placeholder="请填写您的联系姓名"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="v12-pa-2 acea-row row-between-wrapper">
|
||||
<view class="v12-font-24 v12-secondary-dark-text v12-pr-3 v12-text-right" style="width: 140rpx">联系电话</view>
|
||||
<view class="discount">
|
||||
<input type="text" placeholder="请填写您的联系电话" v-model="contactsTel"/>
|
||||
<input
|
||||
v-model="contactsTel"
|
||||
type="text"
|
||||
placeholder="请填写您的联系电话"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -80,7 +93,11 @@
|
||||
mode=""></image> -->
|
||||
<text class="v12-font-24 v12-secondary-dark-text v12-pr-3 v12-text-right" style="width: 140rpx;">备注</text>
|
||||
</view>
|
||||
<textarea v-model="mark" placeholder="建议与商家协商一致" class="mark v12-font-24 "></textarea>
|
||||
<textarea
|
||||
v-model="mark"
|
||||
placeholder="建议与商家协商一致"
|
||||
class="mark v12-font-24 "
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- v12 -->
|
||||
@@ -180,11 +197,11 @@
|
||||
</view>
|
||||
<view class="list" style="margin-top: 0;">
|
||||
<view
|
||||
class="payItem acea-row row-middle"
|
||||
:class="active === 'weixin' ? 'on' : ''"
|
||||
v-show="isWeixin"
|
||||
@click="payItem('weixin')"
|
||||
style="flex-wrap: nowrap; margin-top: 0"
|
||||
v-show="isWeixin"
|
||||
:class="active === 'weixin' ? 'on' : ''"
|
||||
class="payItem acea-row row-middle"
|
||||
style="flex-wrap: nowrap; margin-top: 0"
|
||||
@click="payItem('weixin')"
|
||||
>
|
||||
<view class="name acea-row v12-font-24">
|
||||
<!-- <view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view> -->
|
||||
@@ -198,11 +215,11 @@
|
||||
</label>
|
||||
</view>
|
||||
<view
|
||||
class="payItem acea-row row-middle"
|
||||
:class="active === 'weixin' ? 'on' : ''"
|
||||
@click="payItem('weixin')"
|
||||
v-show="!isWeixin"
|
||||
style="flex-wrap: nowrap; margin-top: 20rpx"
|
||||
v-show="!isWeixin"
|
||||
:class="active === 'weixin' ? 'on' : ''"
|
||||
class="payItem acea-row row-middle"
|
||||
style="flex-wrap: nowrap; margin-top: 20rpx"
|
||||
@click="payItem('weixin')"
|
||||
>
|
||||
<view class="name acea-row v12-font-24">
|
||||
<!-- <view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view> -->
|
||||
@@ -214,13 +231,12 @@
|
||||
<radio style="transform: scale(0.7);" value="" :checked="active === 'weixin'" color="#C52733"/>
|
||||
<text></text>
|
||||
</label>
|
||||
|
||||
</view>
|
||||
<view
|
||||
class="payItem acea-row row-middle v12-justify-between"
|
||||
:class="active === 'yue' ? 'on' : ''"
|
||||
@click="payItem('yue')"
|
||||
style="flex-wrap: nowrap;"
|
||||
:class="active === 'yue' ? 'on' : ''"
|
||||
class="payItem acea-row row-middle v12-justify-between"
|
||||
style="flex-wrap: nowrap;"
|
||||
@click="payItem('yue')"
|
||||
>
|
||||
<view class="name acea-row v12-font-24">
|
||||
<!-- <view style="background-color: #007AFF;" class="iconfont icon-icon-test"
|
||||
@@ -233,13 +249,10 @@
|
||||
<radio style="transform: scale(0.7);" value="" :checked="active === 'yue'" color="#C52733"/>
|
||||
<text></text>
|
||||
</label>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- v9 优惠券开始 -->
|
||||
<u-popup
|
||||
:show="show"
|
||||
@@ -260,7 +273,6 @@
|
||||
/>
|
||||
</u-popup>
|
||||
<!-- v9 优惠券结束 -->
|
||||
|
||||
<view style="height:80rpx"></view>
|
||||
<view class="footer v12-justify-end v12-px-3" style="height: 120rpx;">
|
||||
<view class="v12-align-center v12-px-4">
|
||||
@@ -301,19 +313,24 @@
|
||||
|
||||
<script>
|
||||
import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard'
|
||||
import OrderGoods from "@/components/OrderGoods";
|
||||
import AddressWindow from "@/components/AddressWindow";
|
||||
import {createOrder, postOrderComputed, postOrderConfirm} from "@/api/order";
|
||||
import {mapGetters} from "vuex";
|
||||
import {weappPay} from "@/libs/wechat";
|
||||
import {isNullOrEmpty, isWeixin} from "@/utils";
|
||||
import blPaymentPasswordInput from '@/components/blPaymentPasswordInput.vue';
|
||||
import uniPopup from '@/components/uni-popup/uni-popup.vue';
|
||||
import OrderGoods from "@/components/OrderGoods"
|
||||
import AddressWindow from "@/components/AddressWindow"
|
||||
import {
|
||||
createOrder,
|
||||
postOrderComputed,
|
||||
postOrderConfirm,
|
||||
getAddressDefaultSelected
|
||||
} from "@/api/order"
|
||||
import {mapGetters} from "vuex"
|
||||
import {weappPay} from "@/libs/wechat"
|
||||
import {isNullOrEmpty, isWeixin} from "@/utils"
|
||||
import blPaymentPasswordInput from '@/components/blPaymentPasswordInput.vue'
|
||||
import uniPopup from '@/components/uni-popup/uni-popup.vue'
|
||||
import CouponsPopup from "@/components/CouponsPopup.vue"
|
||||
import { pageListenMixins } from '@/mixins/pageListenMixins'
|
||||
|
||||
const NAME = "OrderSubmission",
|
||||
_isWeixin = isWeixin();
|
||||
const NAME = "OrderSubmission"
|
||||
const _isWeixin = isWeixin()
|
||||
export default {
|
||||
name: NAME,
|
||||
components: {
|
||||
@@ -377,16 +394,16 @@ export default {
|
||||
pageKeyId: Object.freeze('orderConfirm'),
|
||||
total: 0,
|
||||
couponTitle: '',
|
||||
hasCoupon: false,
|
||||
};
|
||||
hasCoupon: false
|
||||
}
|
||||
},
|
||||
computed: mapGetters(["userInfo", "storeItems"]),
|
||||
watch: {
|
||||
useIntegral() {
|
||||
this.computedPrice('useIntegral');
|
||||
this.computedPrice('useIntegral')
|
||||
},
|
||||
shipping_type() {
|
||||
this.computedPrice('shipping_type');
|
||||
this.computedPrice('shipping_type')
|
||||
},
|
||||
async couponId(value) {
|
||||
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === +value)
|
||||
@@ -395,7 +412,6 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad(opts) {
|
||||
console.log(opts);
|
||||
const that = this
|
||||
if (that.$yroute.query.pinkid !== undefined) {
|
||||
that.pinkId = that.$yroute.query.pinkid
|
||||
@@ -408,43 +424,27 @@ export default {
|
||||
that.lotteryRecordId = that.$yroute.query.lotteryRecordId
|
||||
}
|
||||
that.hasCoupon = opts.couponId !== ''
|
||||
that.getCartInfo()
|
||||
},
|
||||
onShow() {
|
||||
const _this = this
|
||||
_this.getCartInfo()
|
||||
//获取用户信息
|
||||
_this.$store.dispatch("getUser", true)
|
||||
// 监听到选择收货地址
|
||||
const chooseAddress = uni.getStorageSync('chooseAddress') || {}
|
||||
const sourceAddress = uni.getStorageSync('sourceAddress') || {}
|
||||
// const sourceAddress = uni.getStorageSync('sourceAddress') || {}
|
||||
// 监听到选择收货地址
|
||||
if (chooseAddress.id && (chooseAddress.id !== sourceAddress.id)) {
|
||||
if (chooseAddress.id) {
|
||||
_this.addressInfo = chooseAddress
|
||||
// 地址切换也要重新计算一下
|
||||
uni.setStorageSync('sourceAddress', _this.addressInfo || '')
|
||||
// uni.setStorageSync('sourceAddress', _this.addressInfo || '')
|
||||
uni.setStorageSync('sourceAddress', {})
|
||||
_this.computedPrice('onLoad chooseAddress')
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
uni.setStorageSync('chooseAddress', {})
|
||||
}, 1000)
|
||||
// uni.showModal({
|
||||
// title:'确定修改地址吗?',
|
||||
// content: '',
|
||||
// showCancel: true,
|
||||
// cancelText: '取消',
|
||||
// confirmText: '确认',
|
||||
// success: (res) => {
|
||||
// if(res.confirm) {
|
||||
|
||||
// }
|
||||
// },
|
||||
// complete: () => {
|
||||
// uni.hideLoading()
|
||||
// uni.setStorageSync('chooseAddress', {})
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
isNullOrEmpty,
|
||||
@@ -453,26 +453,25 @@ export default {
|
||||
this.couponId = this.$yroute.query.couponId || uni.getStorageSync('couponId') || 0
|
||||
},
|
||||
showStoreList() {
|
||||
this.$store.commit("get_to", "orders");
|
||||
this.$store.commit("get_to", "orders")
|
||||
this.$yrouter.push({
|
||||
path: "/pages/shop/StoreList/index"
|
||||
});
|
||||
})
|
||||
},
|
||||
force2Decimal(value) {
|
||||
return this.$force2Decimal(value);
|
||||
return this.$force2Decimal(value)
|
||||
},
|
||||
usePointsCheckChange(e) {
|
||||
this.computedPrice()
|
||||
},
|
||||
// 计算订单金额
|
||||
computedPrice(f) {
|
||||
let shipping_type = this.shipping_type;
|
||||
postOrderComputed(this.orderGroupInfo.orderKey, {
|
||||
addressId: this.addressInfo.id,
|
||||
useIntegral: this.useIntegral ? 1 : 0,
|
||||
couponId: this.couponList.usable.length === 0 ? 0 : this.couponId || 0,
|
||||
usePoints: this.usePointsCheck ? 1 : 0,
|
||||
shipping_type: parseInt(shipping_type) + 1
|
||||
shipping_type: parseInt(this.shipping_type) + 1
|
||||
}).then(res => {
|
||||
const data = res.data;
|
||||
if (data.status === "EXTEND_ORDER") {
|
||||
@@ -481,18 +480,16 @@ export default {
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
});
|
||||
})
|
||||
} else {
|
||||
this.orderPrice = data.result;
|
||||
console.log(this.orderPrice);
|
||||
|
||||
if (this.usePointsCheck) {
|
||||
this.usePointsNumber = data.result.usedPoints
|
||||
} else {
|
||||
this.usePointsNumber = 0
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
getCartInfo() {
|
||||
const _this = this
|
||||
@@ -532,17 +529,18 @@ export default {
|
||||
_this.usePointsCheck = true
|
||||
_this.usePointsNumber = data.maxPoints
|
||||
}
|
||||
if(_this.$yroute.query.address !== undefined ) {
|
||||
_this.addressInfo = JSON.parse(_this.$yroute.query.address) || {}
|
||||
} else {
|
||||
_this.addressInfo = uni.getStorageSync('sourceAddress') || data.addressInfo || {}
|
||||
console.log(data.addressInfo);
|
||||
|
||||
}
|
||||
|
||||
_this.systemStore = data.systemStore || {}
|
||||
_this.storeSelfMention = data.storeSelfMention
|
||||
_this.computedPrice()
|
||||
if(_this.$yroute.query.address !== undefined ) {
|
||||
_this.addressInfo = JSON.parse(_this.$yroute.query.address) || {}
|
||||
_this.computedPrice()
|
||||
} else {
|
||||
// _this.addressInfo = uni.getStorageSync('sourceAddress') || data.addressInfo || {}
|
||||
getAddressDefaultSelected().then(res => {
|
||||
_this.addressInfo = res.data
|
||||
_this.computedPrice()
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.msg,
|
||||
@@ -552,32 +550,33 @@ export default {
|
||||
})
|
||||
},
|
||||
addressTap: function () {
|
||||
//改用跳转页面方式
|
||||
uni.setStorageSync('sourceAddress', this.addressInfo)
|
||||
// 改用跳转页面方式
|
||||
this.$yrouter.push({
|
||||
path: "/pages/user/address/AddressManagement/index",
|
||||
query: {
|
||||
choosMode: 1
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
addressRedirect() {
|
||||
this.addressLoaded = false;
|
||||
this.showAddress = false;
|
||||
this.addressLoaded = false
|
||||
this.showAddress = false
|
||||
},
|
||||
payItem: function (index) {
|
||||
this.active = index;
|
||||
this.active = index
|
||||
},
|
||||
changeAddress(addressInfo) {
|
||||
this.addressInfo = addressInfo;
|
||||
this.addressInfo = addressInfo
|
||||
//地址切换也要重新计算一下
|
||||
this.computedPrice('changeAddress');
|
||||
this.computedPrice('changeAddress')
|
||||
},
|
||||
pwdPopClose() {
|
||||
this.isShowPayPwdPop = false;
|
||||
this.isShowPayPwdPop = false
|
||||
},
|
||||
pwdPopFinish(payPwd) {
|
||||
this.payPassword = payPwd;
|
||||
this.createOrder(true);
|
||||
this.payPassword = payPwd
|
||||
this.createOrder(true)
|
||||
},
|
||||
//支付密码输入监听
|
||||
onInput(e) {
|
||||
@@ -585,55 +584,56 @@ export default {
|
||||
},
|
||||
// 支付密码输入确认
|
||||
onConfirm(e) {
|
||||
this.payPassword = e.value;
|
||||
this.$refs.popup.close();//关闭支付密码弹窗
|
||||
this.$refs.secrity.clear();//清空支付密码
|
||||
this.createOrder(true);
|
||||
this.payPassword = e.value
|
||||
this.$refs.popup.close()
|
||||
this.$refs.secrity.clear()
|
||||
this.createOrder(true)
|
||||
},
|
||||
subscribePay() {
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: ['7O3wKw7_D4t7yfSOlvecKuOQP8QEPY88uBx2FJg43HE', 'TSmTnGibZ8IxWCiRWOvLxha6-0u7tE-V1-WbDCiPkKU', '9Q6xLHe6HyjkU5Zn5k_2zxYPf2y4MxVyUbOSW8pcZRU'],
|
||||
tmplIds: [
|
||||
'7O3wKw7_D4t7yfSOlvecKuOQP8QEPY88uBx2FJg43HE',
|
||||
'TSmTnGibZ8IxWCiRWOvLxha6-0u7tE-V1-WbDCiPkKU',
|
||||
'9Q6xLHe6HyjkU5Zn5k_2zxYPf2y4MxVyUbOSW8pcZRU'
|
||||
],
|
||||
complete: () => this.createOrder(false)
|
||||
})
|
||||
},
|
||||
createOrder(isyue) {
|
||||
let shipping_type = this.shipping_type;
|
||||
if (!this.active) {
|
||||
uni.showToast({
|
||||
title: "请选择支付方式",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!this.addressInfo.id && !this.shipping_type) {
|
||||
uni.showToast({
|
||||
title: "请选择收货地址",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (this.shipping_type) {
|
||||
if (
|
||||
(this.contacts === "" || this.contactsTel === "") &&
|
||||
this.shipping_type
|
||||
(this.contacts === "" || this.contactsTel === "") &&
|
||||
this.shipping_type
|
||||
) {
|
||||
uni.showToast({
|
||||
title: "请填写联系人或联系人电话",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) {
|
||||
uni.showToast({
|
||||
title: "请填写正确的手机号",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) {
|
||||
@@ -641,41 +641,36 @@ export default {
|
||||
title: "请填写您的真实姓名",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
//判断如果是余额支付,先要输入支付密码
|
||||
// 判断如果是余额支付,先要输入支付密码
|
||||
if (this.active == 'yue' && !isyue) {
|
||||
//先判断用户是否绑定过手机
|
||||
// 先判断用户是否绑定过手机
|
||||
if (this.userInfo.phone) {
|
||||
//再判断用户是否设置过支付密码
|
||||
// 再判断用户是否设置过支付密码
|
||||
if (this.userInfo.hasPwdPay) {
|
||||
//显示输入支付密码
|
||||
this.isShowPayPwdPop = true;
|
||||
// 显示输入支付密码
|
||||
this.isShowPayPwdPop = true
|
||||
} else {
|
||||
//设置支付密码
|
||||
this.$yrouter.push("/pkg_user/views/payPassword?isSetMode=true");
|
||||
// 设置支付密码
|
||||
this.$yrouter.push("/pkg_user/views/payPassword?isSetMode=true")
|
||||
}
|
||||
} else {
|
||||
//跳转到绑定手机
|
||||
this.$yrouter.push("/pkg_user/views/bindPhone");
|
||||
// 跳转到绑定手机
|
||||
this.$yrouter.push("/pkg_user/views/bindPhone")
|
||||
}
|
||||
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: "生成订单中"
|
||||
});
|
||||
let from = {};
|
||||
})
|
||||
let from = {}
|
||||
if (this.$deviceType == "app") {
|
||||
from.from = "app";
|
||||
from.from = "app"
|
||||
}
|
||||
console.log(this.storeItems, this.systemStore);
|
||||
|
||||
var params = {
|
||||
const params = {
|
||||
realName: this.contacts,
|
||||
phone: this.contactsTel,
|
||||
addressId: this.addressInfo.id,
|
||||
@@ -696,112 +691,103 @@ export default {
|
||||
uni.setStorageSync('chooseAddress', {})
|
||||
//余额支付的支付密码
|
||||
if (this.active == 'yue') {
|
||||
params.passwordPay = this.payPassword;
|
||||
params.passwordPay = this.payPassword
|
||||
}
|
||||
uni.removeStorageSync('couponId')
|
||||
|
||||
var that = this;
|
||||
createOrder(this.orderGroupInfo.orderKey, params)
|
||||
.then(res => {
|
||||
uni.hideLoading();
|
||||
const data = res.data;
|
||||
switch (data.status) {
|
||||
case "ORDER_EXIST":
|
||||
case "EXTEND_ORDER":
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "PAY_DEFICIENCY":
|
||||
break;
|
||||
|
||||
case "PAY_ERROR":
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "SUCCESS":
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "WECHAT_H5_PAY":
|
||||
// H5支付
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
// location.href = data.result.jsConfig.mweb_url;
|
||||
}, 100);
|
||||
break;
|
||||
case "WECHAT_PAY":
|
||||
// 小程序支付
|
||||
weappPay(data.result.jsConfig).finally(() => {
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "WECHAT_APP_PAY":
|
||||
// APP支付
|
||||
weappPay(data.result.jsConfig).finally(() => {
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
uni.hideLoading();
|
||||
var that = this
|
||||
createOrder(this.orderGroupInfo.orderKey, params).then(res => {
|
||||
uni.hideLoading()
|
||||
const data = res.data
|
||||
switch (data.status) {
|
||||
case "ORDER_EXIST":
|
||||
case "EXTEND_ORDER":
|
||||
uni.showToast({
|
||||
title:
|
||||
err.msg ||
|
||||
err.response.data.msg ||
|
||||
err.response.data.message ||
|
||||
"创建订单失败",
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "PAY_DEFICIENCY":
|
||||
break;
|
||||
case "PAY_ERROR":
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
});
|
||||
}).finally(function () {
|
||||
that.isShowPayPwdPop = false;
|
||||
that.$refs.payPwdPop.clear();//清空支付密码
|
||||
that.$refs.payPwdPop.close();//关闭支付密码弹窗
|
||||
});
|
||||
break;
|
||||
case "SUCCESS":
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "WECHAT_H5_PAY":
|
||||
// H5支付
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "WECHAT_PAY":
|
||||
// 小程序支付
|
||||
weappPay(data.result.jsConfig).finally(() => {
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
})
|
||||
})
|
||||
break;
|
||||
case "WECHAT_APP_PAY":
|
||||
// APP支付
|
||||
weappPay(data.result.jsConfig).finally(() => {
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: data.result.orderId
|
||||
}
|
||||
});
|
||||
})
|
||||
break;
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: err.msg ||
|
||||
err.response.data.msg ||
|
||||
err.response.data.message ||
|
||||
"创建订单失败",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
}).finally(function () {
|
||||
that.isShowPayPwdPop = false
|
||||
that.$refs.payPwdPop.clear()
|
||||
that.$refs.payPwdPop.close()
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.show = !this.show
|
||||
@@ -813,7 +799,7 @@ export default {
|
||||
this.show = !this.show
|
||||
this.couponId = uni.getStorageSync('couponId') || 0
|
||||
this.couponTitle = item.couponTitle
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user