Feat:优惠券对接
This commit is contained in:
@@ -193,7 +193,7 @@
|
||||
<view class="conter" style="width: auto !important;">¥{{ force2Decimal(orderInfo.totalPrice) }}</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between" v-if="orderInfo.couponPrice > 0">
|
||||
<view>优惠券抵扣:</view>
|
||||
<view class="flex-0">优惠券抵扣:</view>
|
||||
<view class="conter">-¥{{ force2Decimal(orderInfo.couponPrice) }}</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between" v-if="orderInfo.useIntegral > 0">
|
||||
|
||||
@@ -1,31 +1,6 @@
|
||||
<template>
|
||||
<view class="order-submission" style="padding: 30rpx;">
|
||||
<view class="allAddress" style="background-color: #f6f6f6;">
|
||||
<!-- <view class="nav acea-row">
|
||||
<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="acea-row" style="padding-left: 28rpx;">
|
||||
<view v-if="systemStore" class="item" style="position: relative;" @click="addressType(0)">
|
||||
<text :class="shipping_type === 0 ? 'on' :''" class="goods-detail-title">送货上门</text>
|
||||
<text v-if="shipping_type === 0" class="pink-dot"></text>
|
||||
</view>
|
||||
<view v-if="storeSelfMention" class="item" style="position: relative;margin-left: 40rpx;" @click="addressType(1)">
|
||||
<text :class="shipping_type === 1 ? 'on' :''" class="goods-detail-title">到店自取</text>
|
||||
<text v-if="shipping_type === 1" class="pink-dot"></text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view
|
||||
class="address acea-row row-middle"
|
||||
@@ -42,7 +17,7 @@
|
||||
<text class="phone">{{ addressInfo.phone }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<!-- <text class="default font-color-lightred" v-if="addressInfo.isDefault">[默认]</text> -->
|
||||
|
||||
{{ addressInfo.province }}{{ addressInfo.city }}{{ addressInfo.district }}{{ addressInfo.detail }}
|
||||
</view>
|
||||
</view>
|
||||
@@ -74,42 +49,8 @@
|
||||
|
||||
<OrderGoods :evaluate="0" :cartInfo="orderGroupInfo.cartInfo" title="商品列表"></OrderGoods>
|
||||
|
||||
|
||||
<view class="wrapper" style="margin: 30rpx 0;border-radius: 16rpx;">
|
||||
|
||||
<!-- 优惠券开始 -->
|
||||
<!-- <view class="item acea-row row-between-wrapper" @click="couponTap" v-if="deduction === false">
|
||||
<view>优惠券</view>
|
||||
<view class="discount">
|
||||
{{ usableCoupon.couponTitle || "请选择" }}
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 优惠券结束 -->
|
||||
|
||||
<!-- 积分抵扣开始 -->
|
||||
<!-- <view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-if="deduction === false && enableIntegral === true"
|
||||
>
|
||||
<view>积分抵扣</view>
|
||||
<view class="discount">
|
||||
<view class="select-btn">
|
||||
<view class="checkbox-wrapper">
|
||||
<checkbox-group @change="changeUseIntegral">
|
||||
<label class="well-check">
|
||||
<text class="integral">
|
||||
当前积分
|
||||
<text class="num font-color-red">{{ userInfo.integral || 0 }}</text>
|
||||
</text>
|
||||
<checkbox value="true" :checked="useIntegral ? true : false"></checkbox>
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 积分抵扣结束 -->
|
||||
|
||||
<view class="item acea-row row-between-wrapper" style="flex-wrap: nowrap;" v-if="shipping_type === 0">
|
||||
<view class="acea-row row-middle" style="flex-wrap: nowrap;">
|
||||
@@ -117,13 +58,6 @@
|
||||
mode=""></image>
|
||||
<text class="">快递费用</text>
|
||||
</view>
|
||||
<!-- <view class="discount">
|
||||
{{
|
||||
orderGroupInfo.priceGroup.storePostage > 0
|
||||
? force2Decimal(orderGroupInfo.priceGroup.storePostage)
|
||||
: (orderPrice.payPostage>0?force2Decimal(orderPrice.payPostage):"免运费")
|
||||
}}
|
||||
</view> -->
|
||||
<view class="discount" style="width: auto !important;">
|
||||
{{ orderPrice.payPostage > 0 ? force2Decimal(orderPrice.payPostage) : "免运费" }}
|
||||
</view>
|
||||
@@ -148,7 +82,7 @@
|
||||
mode=""></image>
|
||||
<text class="">备注信息(150字以内)</text>
|
||||
</view>
|
||||
<textarea v-model="mark" ></textarea>
|
||||
<textarea v-model="mark"></textarea>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapper" style="margin: 30rpx 0;border-radius: 16rpx;">
|
||||
@@ -237,6 +171,25 @@
|
||||
<view class="money">-¥{{ force2Decimal(orderPrice.deductionPrice) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="coupon-cell flex jc-between ai-center" @click="changeCoupons">
|
||||
<view class="title">优惠券:</view>
|
||||
<view class="flex ai-center">
|
||||
<text style="color:#999999" v-if="couponList.usable.length===0">无</text>
|
||||
<view class="flex ai-center" v-else>
|
||||
<text style="color:#FF564A">{{ couponIndex < 0 ? '去选择' : -couponList.usable[couponIndex].couponPrice }}
|
||||
</text>
|
||||
<view class="iconfont icon-jiantou" style="flex-shrink: 0;"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- v9 优惠券开始 -->
|
||||
<u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons">
|
||||
<CouponsPopup :two-list="couponList" @close="changeCoupons" v-if="couponList.usable"/>
|
||||
</u-popup>
|
||||
<!-- v9 优惠券结束 -->
|
||||
|
||||
<view style="height:80rpx"></view>
|
||||
<view class="footer acea-row row-between-wrapper" style="height: 80rpx;">
|
||||
<view style="margin-left: 30rpx;">
|
||||
@@ -248,14 +201,6 @@
|
||||
</view>
|
||||
<view class="settlement acea-row row-middle row-center" @click="subscribePay">立即结算</view>
|
||||
</view>
|
||||
<CouponListWindow
|
||||
v-on:couponchange="changecoupon($event)"
|
||||
v-model="showCoupon"
|
||||
:price="orderPrice.totalPrice"
|
||||
:checked="usableCoupon.id"
|
||||
@checked="changeCoupon"
|
||||
:cartid="cartid"
|
||||
></CouponListWindow>
|
||||
<AddressWindow
|
||||
@checked="changeAddress"
|
||||
@redirect="addressRedirect"
|
||||
@@ -263,23 +208,15 @@
|
||||
:checked="addressInfo.id"
|
||||
ref="mychild"
|
||||
></AddressWindow>
|
||||
<!-- <uni-popup ref="popup" type="bottom">
|
||||
<blPaymentPasswordInput hideTopBorder ref="secrity" @input="onInput" @confirm="onConfirm">
|
||||
<block slot='header' style='width: 100%;'>
|
||||
<view style="font-size: 36rpx;color: #8B8F99;margin: 10rpx 0;">请输入支付密码</view>
|
||||
</block>
|
||||
</blPaymentPasswordInput>
|
||||
</uni-popup> -->
|
||||
|
||||
<passkeyborad :money="orderPrice.payPrice" showMoney :show="isShowPayPwdPop" ref='payPwdPop' @close="pwdPopClose"
|
||||
@finish="pwdPopFinish"></passkeyborad>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard'
|
||||
import OrderGoods from "@/components/OrderGoods";
|
||||
import CouponListWindow from "@/components/CouponListWindow";
|
||||
import AddressWindow from "@/components/AddressWindow";
|
||||
import {createOrder, postOrderComputed, postOrderConfirm} from "@/api/order";
|
||||
import {mapGetters} from "vuex";
|
||||
@@ -287,6 +224,7 @@ 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"
|
||||
|
||||
const NAME = "OrderSubmission",
|
||||
_isWeixin = isWeixin();
|
||||
@@ -294,11 +232,11 @@ export default {
|
||||
name: NAME,
|
||||
components: {
|
||||
OrderGoods,
|
||||
CouponListWindow,
|
||||
AddressWindow,
|
||||
blPaymentPasswordInput,
|
||||
uniPopup,
|
||||
passkeyborad
|
||||
passkeyborad,
|
||||
CouponsPopup
|
||||
},
|
||||
props: {},
|
||||
data: function () {
|
||||
@@ -312,16 +250,13 @@ export default {
|
||||
enableIntegralNum: 0,
|
||||
isWeixin: _isWeixin,
|
||||
pinkId: 0,
|
||||
// active: _isWeixin ? "weixin" : "yue",
|
||||
active: "weixin",
|
||||
showCoupon: false,
|
||||
showAddress: false,
|
||||
addressInfo: {},
|
||||
couponId: 0,
|
||||
orderGroupInfo: {
|
||||
priceGroup: {}
|
||||
},
|
||||
usableCoupon: {},
|
||||
addressLoaded: false,
|
||||
useIntegral: false,
|
||||
orderPrice: {
|
||||
@@ -334,46 +269,34 @@ export default {
|
||||
contactsTel: "",
|
||||
storeSelfMention: 0,
|
||||
cartid: "",
|
||||
payPassword: null
|
||||
payPassword: null,
|
||||
// v9-2
|
||||
couponList: {},
|
||||
couponId: 0,
|
||||
couponIndex: -1,
|
||||
show: false
|
||||
};
|
||||
},
|
||||
computed: mapGetters(["userInfo", "storeItems"]),
|
||||
watch: {
|
||||
useIntegral() {
|
||||
this.computedPrice();
|
||||
this.computedPrice('useIntegral');
|
||||
},
|
||||
// $yroute(n) {
|
||||
// if (n.name === NAME){
|
||||
// this.getCartInfo();
|
||||
// // this.$store.dispatch("getUser", true);
|
||||
// }
|
||||
// },
|
||||
shipping_type() {
|
||||
this.computedPrice();
|
||||
this.computedPrice('shipping_type');
|
||||
},
|
||||
couponId() {
|
||||
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === this.couponId)
|
||||
this.computedPrice('couponId')
|
||||
}
|
||||
},
|
||||
// mounted: function() {
|
||||
// let that = this;
|
||||
// // this.$store.dispatch("getUser", true);
|
||||
// that.getCartInfo();
|
||||
// console.log(that.$yroute);
|
||||
// if (that.$yroute.query.pinkid !== undefined) {
|
||||
// that.pinkId = that.$yroute.query.pinkid;
|
||||
// }
|
||||
// if (that.$yroute.query.id !== undefined) {
|
||||
// that.cartid = that.$yroute.query.id;
|
||||
// console.log(that.cartid)
|
||||
// }
|
||||
// },
|
||||
onLoad: function () {
|
||||
//获取用户信息
|
||||
// this.$store.dispatch("getUser", true);
|
||||
let that = this;
|
||||
uni.$on('chooseAddress', (res) => {
|
||||
console.log('监听到选择收货地址:' + JSON.stringify(res));
|
||||
that.addressInfo = res;
|
||||
//地址切换也要重新计算一下
|
||||
that.computedPrice();
|
||||
that.computedPrice('onLoad chooseAddress');
|
||||
})
|
||||
that.getCartInfo();
|
||||
console.log(that.$yroute);
|
||||
@@ -404,27 +327,13 @@ export default {
|
||||
force2Decimal(value) {
|
||||
return this.$force2Decimal(value);
|
||||
},
|
||||
addressType: function (index) {
|
||||
if (index && !this.systemStore.id) {
|
||||
uni.showToast({
|
||||
title: "暂无门店信息,您无法选择到店自提!",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.shipping_type = index;
|
||||
},
|
||||
changeUseIntegral: function (e) {
|
||||
// this.computedPrice();
|
||||
this.useIntegral = e.mp.detail.value[0];
|
||||
},
|
||||
computedPrice() {
|
||||
computedPrice(f) {
|
||||
console.log(f)
|
||||
let shipping_type = this.shipping_type;
|
||||
postOrderComputed(this.orderGroupInfo.orderKey, {
|
||||
addressId: this.addressInfo.id,
|
||||
useIntegral: this.useIntegral ? 1 : 0,
|
||||
couponId: this.usableCoupon.id || 0,
|
||||
couponId: this.couponId || 0,
|
||||
shipping_type: parseInt(shipping_type) + 1
|
||||
}).then(res => {
|
||||
const data = res.data;
|
||||
@@ -456,11 +365,12 @@ export default {
|
||||
that.offlinePayStatus = res.data.offline_pay_status;
|
||||
that.orderGroupInfo = res.data;
|
||||
that.deduction = res.data.deduction;
|
||||
that.usableCoupon = res.data.usableCoupon || {};
|
||||
that.couponList = res.data.couponList
|
||||
that.addressInfo = res.data.addressInfo || {};
|
||||
that.systemStore = res.data.systemStore || {};
|
||||
that.storeSelfMention = res.data.storeSelfMention;
|
||||
that.computedPrice();
|
||||
that.couponId = uni.getStorageSync('couponId') || 0
|
||||
that.computedPrice()
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
@@ -471,13 +381,6 @@ export default {
|
||||
});
|
||||
},
|
||||
addressTap: function () {
|
||||
|
||||
// this.showAddress = true;
|
||||
// if (!this.addressLoaded) {
|
||||
// this.addressLoaded = true;
|
||||
// this.$refs.mychild.getAddressList();
|
||||
// }
|
||||
|
||||
//改用跳转页面方式
|
||||
this.$yrouter.push({
|
||||
path: "/pages/user/address/AddressManagement/index",
|
||||
@@ -485,34 +388,18 @@ export default {
|
||||
choosMode: 1
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
addressRedirect() {
|
||||
this.addressLoaded = false;
|
||||
this.showAddress = false;
|
||||
},
|
||||
couponTap: function () {
|
||||
this.showCoupon = true;
|
||||
},
|
||||
changeCoupon: function (coupon) {
|
||||
if (!coupon) {
|
||||
this.usableCoupon = {
|
||||
couponTitle: "不使用优惠券",
|
||||
id: 0
|
||||
};
|
||||
} else {
|
||||
this.usableCoupon = coupon;
|
||||
}
|
||||
this.computedPrice();
|
||||
},
|
||||
payItem: function (index) {
|
||||
this.active = index;
|
||||
},
|
||||
changeAddress(addressInfo) {
|
||||
this.addressInfo = addressInfo;
|
||||
//地址切换也要重新计算一下
|
||||
this.computedPrice();
|
||||
this.computedPrice('changeAddress');
|
||||
},
|
||||
pwdPopClose() {
|
||||
this.isShowPayPwdPop = false;
|
||||
@@ -527,17 +414,10 @@ export default {
|
||||
},
|
||||
// 支付密码输入确认
|
||||
onConfirm(e) {
|
||||
let password = e.value;
|
||||
|
||||
// if(password)
|
||||
console.log('password:' + password);
|
||||
|
||||
this.payPassword = password;
|
||||
this.payPassword = e.value;
|
||||
this.$refs.popup.close();//关闭支付密码弹窗
|
||||
this.$refs.secrity.clear();//清空支付密码
|
||||
this.createOrder(true);
|
||||
|
||||
|
||||
},
|
||||
subscribePay() {
|
||||
uni.requestSubscribeMessage({
|
||||
@@ -629,7 +509,7 @@ export default {
|
||||
phone: this.contactsTel,
|
||||
addressId: this.addressInfo.id,
|
||||
useIntegral: this.useIntegral ? 1 : 0,
|
||||
couponId: this.usableCoupon.id || 0,
|
||||
couponId: this.couponId || 0,
|
||||
payType: this.active,
|
||||
pinkId: this.pinkId,
|
||||
seckillId: this.orderGroupInfo.seckill_id,
|
||||
@@ -646,6 +526,7 @@ export default {
|
||||
if (this.active == 'yue') {
|
||||
params.passwordPay = this.payPassword;
|
||||
}
|
||||
uni.removeStorageSync('couponId')
|
||||
|
||||
var that = this;
|
||||
createOrder(this.orderGroupInfo.orderKey, params)
|
||||
@@ -731,12 +612,6 @@ export default {
|
||||
});
|
||||
});
|
||||
break;
|
||||
// 下面为原先微信支付方式,
|
||||
// pay(data.result.jsConfig).finally(() => {
|
||||
// this.$yrouter.replace({
|
||||
// path: "/pages/order/OrderDetails/index" ,query: { id: data.result.orderId}
|
||||
// });
|
||||
// });
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
@@ -755,12 +630,18 @@ export default {
|
||||
that.$refs.payPwdPop.clear();//清空支付密码
|
||||
that.$refs.payPwdPop.close();//关闭支付密码弹窗
|
||||
});
|
||||
}
|
||||
},
|
||||
// v9-2
|
||||
changeCoupons() {
|
||||
if (this.couponList.usable.length === 0) return
|
||||
this.show = !this.show
|
||||
this.couponId = uni.getStorageSync('couponId') || 0
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
|
||||
<style scoped lang="less">
|
||||
.pink-dot {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
@@ -829,15 +710,6 @@ export default {
|
||||
|
||||
.order-submission .allAddress {
|
||||
width: 100%;
|
||||
// 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;
|
||||
// padding-top: 40rpx;
|
||||
}
|
||||
|
||||
.order-submission .allAddress .nav {
|
||||
@@ -922,4 +794,12 @@ export default {
|
||||
.order-submission .wrapper .item .discount input::placeholder {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.coupon-cell {
|
||||
margin-top: 12rpx;
|
||||
padding: 30rpx;
|
||||
border-radius: 16rpx;
|
||||
background-color: #FFFFFF;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user