Task:订单提交页面优化/ 提交订单前,若在商品详情页选择了优惠券,则提交订单页面删除该按钮
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<view class="popup-title bold tc v12-justify-between">
|
<view class="popup-title bold tc v12-justify-between">
|
||||||
<text></text>
|
<text></text>
|
||||||
<text>优惠详情</text>
|
<text>优惠详情</text>
|
||||||
<u-icon name="close" color="#666" size="14" @click="close"></u-icon>
|
<u-icon name="close" color="#666" size="14" @click.stop="close"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<SubSection
|
<SubSection
|
||||||
:current="current"
|
:current="current"
|
||||||
@@ -125,6 +125,10 @@ export default {
|
|||||||
currentPrice: {
|
currentPrice: {
|
||||||
default: 0,
|
default: 0,
|
||||||
type: Number
|
type: Number
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -137,6 +141,17 @@ export default {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
id: {
|
||||||
|
immediate: true,
|
||||||
|
handler(value) {
|
||||||
|
console.log('couponId', value);
|
||||||
|
if(value) {
|
||||||
|
this.selectCoupon(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
list() {
|
list() {
|
||||||
const temp = this.current === 0 ? this.twoList['usable'] : this.twoList['unusable']
|
const temp = this.current === 0 ? this.twoList['usable'] : this.twoList['unusable']
|
||||||
@@ -197,6 +212,7 @@ export default {
|
|||||||
if (this.current === 1) return
|
if (this.current === 1) return
|
||||||
uni.setStorageSync('couponId', this.couponId)
|
uni.setStorageSync('couponId', this.couponId)
|
||||||
this.$emit('change', this.selectItem || {})
|
this.$emit('change', this.selectItem || {})
|
||||||
|
this.$emit('ok', this.couponId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="v12-justify-between v12-align-center">
|
<view class="v12-justify-between v12-align-center">
|
||||||
<view class="v12-mr-2" @click="changeCoupons" v-if="couponList.usable.length !== 0">
|
<view class="v12-mr-2" @click="changeCoupons" v-if="couponList.usable.length !== 0 && !hasCoupon">
|
||||||
<text class="v12-dark-text v12-font-24" >{{ couponList.usable.length === 0 ? '无' : '去选择' }}</text>
|
<text class="v12-dark-text v12-font-24" >{{ couponList.usable.length === 0 ? '无' : '去选择' }}</text>
|
||||||
<text class="iconfont icon-jiantou v12-font-24 v12-dark-text"></text>
|
<text class="iconfont icon-jiantou v12-font-24 v12-dark-text"></text>
|
||||||
</view>
|
</view>
|
||||||
@@ -251,7 +251,9 @@
|
|||||||
v-if="couponList.usable.length > 0"
|
v-if="couponList.usable.length > 0"
|
||||||
:two-list="couponList"
|
:two-list="couponList"
|
||||||
@change="changeCoupons"
|
@change="changeCoupons"
|
||||||
|
@close="close"
|
||||||
:currentPrice="force2Decimal(orderPrice.totalPrice)"
|
:currentPrice="force2Decimal(orderPrice.totalPrice)"
|
||||||
|
:id="couponId"
|
||||||
@max="couponMax"
|
@max="couponMax"
|
||||||
:show-tab="false"
|
:show-tab="false"
|
||||||
/>
|
/>
|
||||||
@@ -372,7 +374,8 @@ export default {
|
|||||||
maxPoints: 0,
|
maxPoints: 0,
|
||||||
pageKeyId: Object.freeze('orderConfirm'),
|
pageKeyId: Object.freeze('orderConfirm'),
|
||||||
total: 0,
|
total: 0,
|
||||||
couponTitle: ''
|
couponTitle: '',
|
||||||
|
hasCoupon: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: mapGetters(["userInfo", "storeItems"]),
|
computed: mapGetters(["userInfo", "storeItems"]),
|
||||||
@@ -383,9 +386,9 @@ export default {
|
|||||||
shipping_type() {
|
shipping_type() {
|
||||||
this.computedPrice('shipping_type');
|
this.computedPrice('shipping_type');
|
||||||
},
|
},
|
||||||
couponId() {
|
async couponId(value) {
|
||||||
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === this.couponId)
|
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === value)
|
||||||
this.computedPrice('couponId')
|
await this.computedPrice('couponId')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@@ -400,10 +403,11 @@ export default {
|
|||||||
if (that.$yroute.query.lotteryRecordId !== undefined) {
|
if (that.$yroute.query.lotteryRecordId !== undefined) {
|
||||||
that.lotteryRecordId = that.$yroute.query.lotteryRecordId
|
that.lotteryRecordId = that.$yroute.query.lotteryRecordId
|
||||||
}
|
}
|
||||||
that.getCartInfo()
|
that.hasCoupon = that.$yroute.query.couponId !== ''
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
const _this = this
|
const _this = this
|
||||||
|
_this.getCartInfo()
|
||||||
//获取用户信息
|
//获取用户信息
|
||||||
_this.$store.dispatch("getUser", true)
|
_this.$store.dispatch("getUser", true)
|
||||||
const chooseAddress = uni.getStorageSync('chooseAddress') || {}
|
const chooseAddress = uni.getStorageSync('chooseAddress') || {}
|
||||||
@@ -433,7 +437,7 @@ export default {
|
|||||||
isNullOrEmpty,
|
isNullOrEmpty,
|
||||||
couponMax(e) {
|
couponMax(e) {
|
||||||
this.couponTitle = e.couponTitle
|
this.couponTitle = e.couponTitle
|
||||||
this.couponId = uni.getStorageSync('couponId') || 0
|
this.couponId = this.$yroute.query.couponId || uni.getStorageSync('couponId') || 0
|
||||||
},
|
},
|
||||||
showStoreList() {
|
showStoreList() {
|
||||||
this.$store.commit("get_to", "orders");
|
this.$store.commit("get_to", "orders");
|
||||||
@@ -785,6 +789,9 @@ export default {
|
|||||||
that.$refs.payPwdPop.close();//关闭支付密码弹窗
|
that.$refs.payPwdPop.close();//关闭支付密码弹窗
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
close() {
|
||||||
|
this.show = !this.show
|
||||||
|
},
|
||||||
// v9-2
|
// v9-2
|
||||||
changeCoupons(item) {
|
changeCoupons(item) {
|
||||||
if(!item) return
|
if(!item) return
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
<view
|
<view
|
||||||
v-if="attr.productSelect.earnPoints"
|
v-if="attr.productSelect.earnPoints"
|
||||||
:class="couponListLimit2ToShow.length > 0 ? 'earn-points' : ''"
|
:class="couponListLimit2ToShow.length > 0 ? 'earn-points' : ''"
|
||||||
class="value value2 v12-font-24 v12-primary-text"
|
class="value value2 v12-font-24 v12-primary-text v12-mb-2"
|
||||||
>
|
>
|
||||||
预计获得{{ attr.productSelect.earnPoints }}积分
|
预计获得{{ attr.productSelect.earnPoints }}积分
|
||||||
</view>
|
</view>
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
|
|
||||||
<!-- v9 优惠券开始 -->
|
<!-- v9 优惠券开始 -->
|
||||||
<u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons()">
|
<u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons()">
|
||||||
<CouponsPopup :two-list="couponList" @change="changeCoupons" @close="changeCoupons()" :showTab="false" :currentPrice="storeInfo.price" />
|
<CouponsPopup :two-list="couponList" @ok="setCoupon" @change="changeCoupons" @close="changeCoupons()" :showTab="false" :currentPrice="storeInfo.price" />
|
||||||
</u-popup>
|
</u-popup>
|
||||||
<!-- v9 优惠券结束 -->
|
<!-- v9 优惠券结束 -->
|
||||||
|
|
||||||
@@ -618,7 +618,8 @@ export default {
|
|||||||
isFavorite: false,
|
isFavorite: false,
|
||||||
pageKeyId: '',
|
pageKeyId: '',
|
||||||
couponListLimit2ToShow: [],
|
couponListLimit2ToShow: [],
|
||||||
qualifications: []
|
qualifications: [],
|
||||||
|
couponId: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: mapGetters(['isLogin', 'location', 'userInfo']),
|
computed: mapGetters(['isLogin', 'location', 'userInfo']),
|
||||||
@@ -1383,11 +1384,13 @@ export default {
|
|||||||
postCartAdd(q).then(function (res) {
|
postCartAdd(q).then(function (res) {
|
||||||
that.isOpen = false
|
that.isOpen = false
|
||||||
that.attr.cartAttr = false
|
that.attr.cartAttr = false
|
||||||
|
console.log( that.couponId)
|
||||||
if (news) {
|
if (news) {
|
||||||
that.$yrouter.push({
|
that.$yrouter.push({
|
||||||
path: "/pages/order/OrderSubmission/index",
|
path: "/pages/order/OrderSubmission/index",
|
||||||
query: {
|
query: {
|
||||||
id: res.data.cartId
|
id: res.data.cartId,
|
||||||
|
couponId: that.couponId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -1438,9 +1441,12 @@ export default {
|
|||||||
this.posters = false
|
this.posters = false
|
||||||
},
|
},
|
||||||
// v9-2
|
// v9-2
|
||||||
changeCoupons() {
|
changeCoupons(e) {
|
||||||
this.show = !this.show
|
this.show = !this.show
|
||||||
},
|
},
|
||||||
|
setCoupon(couponId) {
|
||||||
|
this.couponId = couponId
|
||||||
|
},
|
||||||
async checkFavorite() {
|
async checkFavorite() {
|
||||||
const res = await checkProduct(this.id, this.uniqueId)
|
const res = await checkProduct(this.id, this.uniqueId)
|
||||||
if (res.success) this.isFavorite = res.data.hasFavorite
|
if (res.success) this.isFavorite = res.data.hasFavorite
|
||||||
|
|||||||
Reference in New Issue
Block a user