|
|
|
@ -1,11 +1,25 @@
|
|
|
|
|
<template> |
|
|
|
|
<view class="order-submission"> |
|
|
|
|
<view class="allAddress"> |
|
|
|
|
<view class="allAddress" :style="systemStore ? '' : 'padding-top: 0.2*100rpx'"> |
|
|
|
|
<view class="nav acea-row"> |
|
|
|
|
<view class="item font-color-red" :class="shipping_type === 0 ? 'on' : 'on2'" @click="addressType(0)"></view> |
|
|
|
|
<view class="item font-color-red" :class="shipping_type === 1 ? 'on' : 'on2'" @click="addressType(1)" v-if="storeSelfMention"></view> |
|
|
|
|
</view> |
|
|
|
|
<view class="address acea-row row-between-wrapper" v-if="shipping_type === 0" @click="addressTap"> |
|
|
|
|
<view |
|
|
|
|
class="item font-color-red" |
|
|
|
|
:class="shipping_type === 0 ? 'on' : 'on2'" |
|
|
|
|
@click="addressType(0)" |
|
|
|
|
v-if="systemStore" |
|
|
|
|
></view> |
|
|
|
|
<view |
|
|
|
|
class="item font-color-red" |
|
|
|
|
:class="shipping_type === 1 ? 'on' : 'on2'" |
|
|
|
|
@click="addressType(1)" |
|
|
|
|
v-if="storeSelfMention" |
|
|
|
|
></view> |
|
|
|
|
</view> |
|
|
|
|
<view |
|
|
|
|
class="address acea-row row-between-wrapper" |
|
|
|
|
v-if="shipping_type === 0" |
|
|
|
|
@click="addressTap" |
|
|
|
|
> |
|
|
|
|
<view class="addressCon" v-if="addressInfo.realName"> |
|
|
|
|
<view class="name"> |
|
|
|
|
{{ addressInfo.realName }} |
|
|
|
@ -13,8 +27,7 @@
|
|
|
|
|
</view> |
|
|
|
|
<view> |
|
|
|
|
<text class="default font-color-red" v-if="addressInfo.isDefault">[默认]</text> |
|
|
|
|
{{ addressInfo.province }}{{ addressInfo.city |
|
|
|
|
}}{{ addressInfo.district }}{{ addressInfo.detail }} |
|
|
|
|
{{ addressInfo.province }}{{ addressInfo.city}}{{ addressInfo.district }}{{ addressInfo.detail }} |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="addressCon" v-else> |
|
|
|
@ -22,17 +35,18 @@
|
|
|
|
|
</view> |
|
|
|
|
<view class="iconfont icon-jiantou"></view> |
|
|
|
|
</view> |
|
|
|
|
<!--<view class="address acea-row row-between-wrapper" v-else>--> |
|
|
|
|
<!--<view class="addressCon">--> |
|
|
|
|
<!--<view class="name">--> |
|
|
|
|
<!--{{ systemStore.name }}--> |
|
|
|
|
<!--<text class="phone">{{ systemStore.phone }}</text>--> |
|
|
|
|
<!--</view>--> |
|
|
|
|
<!--<view>--> |
|
|
|
|
<!--{{ systemStore._detailed_address }}--> |
|
|
|
|
<!--</view>--> |
|
|
|
|
<!--</view>--> |
|
|
|
|
<!--</view>--> |
|
|
|
|
<div class="address acea-row row-between-wrapper" v-else @click="showStoreList"> |
|
|
|
|
<div class="addressCon"> |
|
|
|
|
<div class="name"> |
|
|
|
|
{{ storeItems.name || systemStore.name }} |
|
|
|
|
<span |
|
|
|
|
class="phone" |
|
|
|
|
>{{storeItems.phone || systemStore.phone}}</span> |
|
|
|
|
</div> |
|
|
|
|
<div>{{ storeItems.address || systemStore.address }}</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="iconfont icon-jiantou"></div> |
|
|
|
|
</div> |
|
|
|
|
<view class="line"> |
|
|
|
|
<image src="@/static/images/line.jpg" /> |
|
|
|
|
</view> |
|
|
|
@ -46,7 +60,10 @@
|
|
|
|
|
<text class="iconfont icon-jiantou"></text> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="item acea-row row-between-wrapper" v-if="deduction === false"> |
|
|
|
|
<view |
|
|
|
|
class="item acea-row row-between-wrapper" |
|
|
|
|
v-if="deduction === false && enableIntegral === true" |
|
|
|
|
> |
|
|
|
|
<view>积分抵扣</view> |
|
|
|
|
<view class="discount"> |
|
|
|
|
<view class="select-btn"> |
|
|
|
@ -98,21 +115,33 @@
|
|
|
|
|
<view class="item"> |
|
|
|
|
<view>支付方式</view> |
|
|
|
|
<view class="list"> |
|
|
|
|
<view class="payItem acea-row row-middle" :class="active === 'weixin' ? 'on' : ''" @click="payItem('weixin')" |
|
|
|
|
v-show="isWeixin"> |
|
|
|
|
<view |
|
|
|
|
class="payItem acea-row row-middle" |
|
|
|
|
:class="active === 'weixin' ? 'on' : ''" |
|
|
|
|
@click="payItem('weixin')" |
|
|
|
|
v-show="isWeixin" |
|
|
|
|
> |
|
|
|
|
<view class="name acea-row row-center-wrapper"> |
|
|
|
|
<view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>微信支付 |
|
|
|
|
</view> |
|
|
|
|
<view class="tip">微信快捷支付</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="payItem acea-row row-middle" :class="active === 'weixin' ? 'on' : ''" @click="payItem('weixin')" |
|
|
|
|
v-show="!isWeixin"> |
|
|
|
|
<view |
|
|
|
|
class="payItem acea-row row-middle" |
|
|
|
|
:class="active === 'weixin' ? 'on' : ''" |
|
|
|
|
@click="payItem('weixin')" |
|
|
|
|
v-show="!isWeixin" |
|
|
|
|
> |
|
|
|
|
<view class="name acea-row row-center-wrapper"> |
|
|
|
|
<view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>微信支付 |
|
|
|
|
</view> |
|
|
|
|
<view class="tip">微信快捷支付</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="payItem acea-row row-middle" :class="active === 'yue' ? 'on' : ''" @click="payItem('yue')"> |
|
|
|
|
<view |
|
|
|
|
class="payItem acea-row row-middle" |
|
|
|
|
:class="active === 'yue' ? 'on' : ''" |
|
|
|
|
@click="payItem('yue')" |
|
|
|
|
> |
|
|
|
|
<view class="name acea-row row-center-wrapper"> |
|
|
|
|
<view class="iconfont icon-icon-test" :class="active === 'yue' ? 'bounceIn' : ''"></view>余额支付 |
|
|
|
|
</view> |
|
|
|
@ -147,10 +176,20 @@
|
|
|
|
|
</view> |
|
|
|
|
<view class="settlement" @click="createOrder">立即结算</view> |
|
|
|
|
</view> |
|
|
|
|
<CouponListWindow v-on:couponchange="changecoupon($event)" v-model="showCoupon" :price="orderPrice.totalPrice" |
|
|
|
|
:checked="usableCoupon.id" @checked="changeCoupon"></CouponListWindow> |
|
|
|
|
<AddressWindow @checked="changeAddress" @redirect="addressRedirect" v-model="showAddress" :checked="addressInfo.id" |
|
|
|
|
ref="mychild"></AddressWindow> |
|
|
|
|
<CouponListWindow |
|
|
|
|
v-on:couponchange="changecoupon($event)" |
|
|
|
|
v-model="showCoupon" |
|
|
|
|
:price="orderPrice.totalPrice" |
|
|
|
|
:checked="usableCoupon.id" |
|
|
|
|
@checked="changeCoupon" |
|
|
|
|
></CouponListWindow> |
|
|
|
|
<AddressWindow |
|
|
|
|
@checked="changeAddress" |
|
|
|
|
@redirect="addressRedirect" |
|
|
|
|
v-model="showAddress" |
|
|
|
|
:checked="addressInfo.id" |
|
|
|
|
ref="mychild" |
|
|
|
|
></AddressWindow> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
<style scoped lang="less"> |
|
|
|
@ -166,49 +205,52 @@
|
|
|
|
|
|
|
|
|
|
.order-submission .allAddress { |
|
|
|
|
width: 100%; |
|
|
|
|
background-image: linear-gradient(to bottom, #e93323 0%, #f5f5f5 100%); |
|
|
|
|
background-image: -webkit-linear-gradient(to bottom, |
|
|
|
|
#e93323 0%, |
|
|
|
|
#f5f5f5 100%); |
|
|
|
|
background-image: -moz-linear-gradient(to bottom, #e93323 0%, #f5f5f5 100%); |
|
|
|
|
padding-top: 0.2*100rpx; |
|
|
|
|
background-image: linear-gradient(to bottom, #00c17b 0%, #00c17b 100%); |
|
|
|
|
background-image: -webkit-linear-gradient( |
|
|
|
|
to bottom, |
|
|
|
|
#00c17b 0%, |
|
|
|
|
#00c17b 100% |
|
|
|
|
); |
|
|
|
|
background-image: -moz-linear-gradient(to bottom, #00c17b 0%, #00c17b 100%); |
|
|
|
|
padding-top: 1 * 100rpx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.order-submission .allAddress .nav { |
|
|
|
|
width: 7.1*100rpx; |
|
|
|
|
margin: 0 auto; |
|
|
|
|
padding: 0 30rpx; |
|
|
|
|
width: 100%; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.order-submission .allAddress .nav .item { |
|
|
|
|
width: 3.55*100rpx; |
|
|
|
|
flex: 1; |
|
|
|
|
position: relative; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.order-submission .allAddress .nav .item.on { |
|
|
|
|
position: relative; |
|
|
|
|
width: 2.5*100rpx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.order-submission .allAddress .nav .item.on:before { |
|
|
|
|
position: absolute; |
|
|
|
|
bottom: 0; |
|
|
|
|
/*content: "快递配送";*/ |
|
|
|
|
content: "快递配送"; |
|
|
|
|
font-size: 0.28 * 100rpx; |
|
|
|
|
display: block; |
|
|
|
|
height: 0; |
|
|
|
|
width: 3.55*100rpx; |
|
|
|
|
border-width: 0 0.2*100rpx 0.8*100rpx 0; |
|
|
|
|
border-style: none solid solid; |
|
|
|
|
border-color: transparent transparent #fff; |
|
|
|
|
left: 0; |
|
|
|
|
right: 0; |
|
|
|
|
border-width: 0.4 * 100rpx; |
|
|
|
|
border-style: solid; |
|
|
|
|
border-color: #fff; |
|
|
|
|
z-index: 9; |
|
|
|
|
border-radius: 0.07*100rpx 0.3*100rpx 0 0; |
|
|
|
|
text-align: center; |
|
|
|
|
line-height: 0.8*100rpx; |
|
|
|
|
line-height: 0.14 * 100rpx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.order-submission .allAddress .nav .item:nth-of-type(2).on:before { |
|
|
|
|
content: "到店自提"; |
|
|
|
|
border-width: 0 0 0.8*100rpx 0.2*100rpx; |
|
|
|
|
border-radius: 0.3*100rpx 0.07*100rpx 0 0; |
|
|
|
|
border-width: 0.4 * 100rpx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.order-submission .allAddress .nav .item.on2 { |
|
|
|
@ -222,31 +264,28 @@
|
|
|
|
|
font-size: 0.28 * 100rpx; |
|
|
|
|
display: block; |
|
|
|
|
height: 0; |
|
|
|
|
width: 4.6*100rpx; |
|
|
|
|
border-width: 0 0 0.6*100rpx 0.6*100rpx; |
|
|
|
|
border-style: none solid solid; |
|
|
|
|
border-color: transparent transparent #f7c1bd; |
|
|
|
|
border-radius: 0.4*100rpx 0.06*100rpx 0 0; |
|
|
|
|
left: 0; |
|
|
|
|
right: 0; |
|
|
|
|
border-width: 0.4 * 100rpx; |
|
|
|
|
border-style: solid; |
|
|
|
|
border-color: #d5e6e6; |
|
|
|
|
text-align: center; |
|
|
|
|
line-height: 0.6*100rpx; |
|
|
|
|
line-height: 0.14 * 100rpx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.order-submission .allAddress .nav .item:nth-of-type(1).on2:before { |
|
|
|
|
content: "快递配送"; |
|
|
|
|
border-width: 0 0.6*100rpx 0.6*100rpx 0; |
|
|
|
|
border-radius: 0.06*100rpx 0.4*100rpx 0 0; |
|
|
|
|
border-width: 0.4 * 100rpx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.order-submission .allAddress .address { |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
width: 100%; |
|
|
|
|
width: 7.1 * 100rpx; |
|
|
|
|
height: 1.5 * 100rpx; |
|
|
|
|
margin: 0 auto; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.order-submission .allAddress .line { |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
width: 100%; |
|
|
|
|
width: 7.1 * 100rpx; |
|
|
|
|
margin: 0 auto; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -258,20 +297,10 @@
|
|
|
|
|
import OrderGoods from "@/components/OrderGoods"; |
|
|
|
|
import CouponListWindow from "@/components/CouponListWindow"; |
|
|
|
|
import AddressWindow from "@/components/AddressWindow"; |
|
|
|
|
import { |
|
|
|
|
postOrderConfirm, |
|
|
|
|
postOrderComputed, |
|
|
|
|
createOrder |
|
|
|
|
} from "@/api/order"; |
|
|
|
|
import { |
|
|
|
|
mapGetters |
|
|
|
|
} from "vuex"; |
|
|
|
|
import { |
|
|
|
|
weappPay |
|
|
|
|
} from "@/libs/wechat"; |
|
|
|
|
import { |
|
|
|
|
isWeixin |
|
|
|
|
} from "@/utils"; |
|
|
|
|
import { postOrderConfirm, postOrderComputed, createOrder } from "@/api/order"; |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
import { weappPay } from "@/libs/wechat"; |
|
|
|
|
import { isWeixin } from "@/utils"; |
|
|
|
|
|
|
|
|
|
const NAME = "OrderSubmission", |
|
|
|
|
_isWeixin = isWeixin(); |
|
|
|
@ -287,11 +316,12 @@
|
|
|
|
|
return { |
|
|
|
|
offlinePayStatus: 2, |
|
|
|
|
from: this.$deviceType, |
|
|
|
|
// from: _isWeixin ? "weixin" : "weixinh5", |
|
|
|
|
deduction: true, |
|
|
|
|
enableIntegral: true, |
|
|
|
|
enableIntegralNum: 0, |
|
|
|
|
isWeixin: _isWeixin, |
|
|
|
|
pinkId: 0, |
|
|
|
|
active: "weixin", |
|
|
|
|
active: _isWeixin ? "weixin" : "yue", |
|
|
|
|
showCoupon: false, |
|
|
|
|
showAddress: false, |
|
|
|
|
addressInfo: {}, |
|
|
|
@ -306,14 +336,14 @@
|
|
|
|
|
payPrice: "计算中" |
|
|
|
|
}, |
|
|
|
|
mark: "", |
|
|
|
|
system_store: {}, |
|
|
|
|
systemStore: {}, |
|
|
|
|
shipping_type: 0, |
|
|
|
|
contacts: "", |
|
|
|
|
contactsTel: "", |
|
|
|
|
store_self_mention: 0 |
|
|
|
|
storeSelfMention: 0 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: mapGetters(["userInfo"]), |
|
|
|
|
computed: mapGetters(["userInfo", "storeItems"]), |
|
|
|
|
watch: { |
|
|
|
|
useIntegral() { |
|
|
|
|
this.computedPrice(); |
|
|
|
@ -327,20 +357,26 @@
|
|
|
|
|
}, |
|
|
|
|
mounted: function() { |
|
|
|
|
let that = this; |
|
|
|
|
this.$store.dispatch('getUser', true) |
|
|
|
|
this.$store.dispatch("getUser", true); |
|
|
|
|
that.getCartInfo(); |
|
|
|
|
if (that.$yroute.query.pinkid !== undefined) |
|
|
|
|
that.pinkId = that.$yroute.query.pinkid; |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
showStoreList() { |
|
|
|
|
this.$store.commit("get_to", "orders"); |
|
|
|
|
this.$yrouter.push({ |
|
|
|
|
path: "/pages/shop/StoreList/index" |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
addressType: function(index) { |
|
|
|
|
if (index && !this.system_store.id) { |
|
|
|
|
if (index && !this.systemStore.id) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "暂无门店信息,您无法选择到店自提!", |
|
|
|
|
icon: 'none', |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
return |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.shipping_type = index; |
|
|
|
|
}, |
|
|
|
@ -374,7 +410,7 @@
|
|
|
|
|
if (!cartIds) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "参数有误", |
|
|
|
|
icon: 'none', |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
return this.$yrouter.back(); |
|
|
|
@ -386,14 +422,14 @@
|
|
|
|
|
this.deduction = res.data.deduction; |
|
|
|
|
this.usableCoupon = res.data.usableCoupon || {}; |
|
|
|
|
this.addressInfo = res.data.addressInfo || {}; |
|
|
|
|
this.system_store = res.data.system_store || {}; |
|
|
|
|
this.store_self_mention = res.data.store_self_mention; |
|
|
|
|
this.systemStore = res.data.systemStore || {}; |
|
|
|
|
this.storeSelfMention = res.data.storeSelfMention; |
|
|
|
|
this.computedPrice(); |
|
|
|
|
}) |
|
|
|
|
.catch(() => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "加载订单数据失败", |
|
|
|
|
icon: 'none', |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
@ -434,18 +470,18 @@
|
|
|
|
|
if (!this.active) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "请选择支付方式", |
|
|
|
|
icon: 'none', |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
return |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!this.addressInfo.id && !this.shipping_type) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "请选择收货地址", |
|
|
|
|
icon: 'none', |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
return |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.shipping_type) { |
|
|
|
@ -455,36 +491,36 @@
|
|
|
|
|
) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "请填写联系人或联系人电话", |
|
|
|
|
icon: 'none', |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
return |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "请填写正确的手机号", |
|
|
|
|
icon: 'none', |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
return |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "请填写您的真实姓名", |
|
|
|
|
icon: 'none', |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
return |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: "生成订单中" |
|
|
|
|
}); |
|
|
|
|
let from = {} |
|
|
|
|
if (this.$deviceType == 'app') { |
|
|
|
|
from.from = 'app' |
|
|
|
|
let from = {}; |
|
|
|
|
if (this.$deviceType == "app") { |
|
|
|
|
from.from = "app"; |
|
|
|
|
} |
|
|
|
|
createOrder(this.orderGroupInfo.orderKey, { |
|
|
|
|
realName: this.contacts, |
|
|
|
@ -500,6 +536,7 @@
|
|
|
|
|
from: this.from, |
|
|
|
|
mark: this.mark || "", |
|
|
|
|
shippingType: parseInt(shipping_type) + 1, |
|
|
|
|
storeId: this.storeItems.id || this.systemStore.id, |
|
|
|
|
...from |
|
|
|
|
}) |
|
|
|
|
.then(res => { |
|
|
|
@ -526,7 +563,7 @@
|
|
|
|
|
case "PAY_ERROR": |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: res.msg, |
|
|
|
|
icon: 'none', |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
this.$yrouter.replace({ |
|
|
|
@ -570,7 +607,7 @@
|
|
|
|
|
id: data.result.orderId |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case "WECHAT_APP_PAY": |
|
|
|
@ -582,7 +619,7 @@
|
|
|
|
|
id: data.result.orderId |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
// 下面为原先微信支付方式, |
|
|
|
|
// pay(data.result.jsConfig).finally(() => { |
|
|
|
@ -596,7 +633,7 @@
|
|
|
|
|
uni.hideLoading(); |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: err.response.data.msg || "创建订单失败", |
|
|
|
|
icon: 'none', |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|