Feat:优惠券对接
This commit is contained in:
@@ -28,7 +28,6 @@ export default {
|
||||
if (memCityName.length) {
|
||||
this.cityName = memCityName;
|
||||
uni.removeStorageSync("cityName")
|
||||
console.log("memCityName if")
|
||||
this.search();
|
||||
}
|
||||
},
|
||||
|
||||
+40
-9
@@ -66,10 +66,10 @@
|
||||
</view>
|
||||
<!-- 快捷跳转块v4end -->
|
||||
|
||||
<!-- <view style="padding-bottom:20rpx;background: #fff;">-->
|
||||
<!-- 转盘-->
|
||||
<!-- <image class="home-luck" :src="`${webUrl}/20220519145845818243.png`" mode="scaleToFill" @click="goLuck"></image>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view style="padding-bottom:20rpx;background: #fff;">-->
|
||||
<!-- 转盘-->
|
||||
<!-- <image class="home-luck" :src="`${webUrl}/20220519145845818243.png`" mode="scaleToFill" @click="goLuck"></image>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<!-- 伴手礼精品 -->
|
||||
<!-- <view class="wrapper hot" v-if="likeInfo.length > 0">-->
|
||||
@@ -244,7 +244,7 @@
|
||||
<!-- v9 老用户弹窗 -->
|
||||
<u-popup :show="isOldUser" mode="center" bgColor="transparent">
|
||||
<view class="popup-old-user flex flex-col ai-center">
|
||||
<image class="main" :src="oldUserPopup.image" mode="scaleToFill" @click="$global.commonJump(oldUserPopup.url)"/>
|
||||
<image class="main" :src="oldUserPopup.image" mode="scaleToFill" @click="tapOld()"/>
|
||||
<view class="icon-box flex jc-center ai-center" @click="changeOldPopup(false)">
|
||||
<image :src="webUrl+'/20230608112219219303.png'" mode="scaleToFill"/>
|
||||
</view>
|
||||
@@ -314,7 +314,7 @@ import hxNavbar from "@/components/hx-navbar/hx-navbar.vue"
|
||||
import imgBox from '@/components/imageTypeSet/imagebox.vue'
|
||||
import LsSwiper from '@/components//ls-swiper/index.vue'
|
||||
|
||||
import {noticeDetail, noticeList} from "@/api/user";
|
||||
import {getCouponReceive, noticeDetail, noticeList} from "@/api/user";
|
||||
import {getHomeData, getShareImage} from '@/api/public';
|
||||
import {getHomeHotelList} from "@/api/inn.js";
|
||||
import {getProducts} from "@/api/store";
|
||||
@@ -457,6 +457,7 @@ export default {
|
||||
},
|
||||
onLoad: function (options) {
|
||||
that = this;
|
||||
this.init();
|
||||
getShareImage().then(({data}) => this.shareAppImg = data);
|
||||
uni.getSystemInfo({
|
||||
success: (e) => {
|
||||
@@ -522,7 +523,6 @@ export default {
|
||||
this.getUnreadMsgList();
|
||||
}
|
||||
|
||||
this.init();
|
||||
//获取团购商品
|
||||
this.getGroupGoods();
|
||||
},
|
||||
@@ -668,6 +668,7 @@ export default {
|
||||
msgConfirm: function () {
|
||||
that.$refs.popup.close();
|
||||
},
|
||||
|
||||
getHotelList: function () {
|
||||
let that = this;
|
||||
|
||||
@@ -829,6 +830,36 @@ export default {
|
||||
|
||||
goFestival() {
|
||||
uni.navigateTo({url: '/pkg_product/views/festival'})
|
||||
},
|
||||
tapOld() {
|
||||
this.isOldUser =false
|
||||
const {type, text, jumpTime, pageLevel, url, params, couponId} = this.oldUserPopup
|
||||
if (couponId != null) {
|
||||
getCouponReceive(couponId).then(res => {
|
||||
if (res.status === 200) {
|
||||
uni.showToast({
|
||||
title: text,
|
||||
icon: 'none',
|
||||
success: () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
}).catch((err) => {
|
||||
uni.showToast({
|
||||
title: err.data.msg+'',
|
||||
icon: 'none',
|
||||
duration:3000
|
||||
})
|
||||
})
|
||||
}
|
||||
// type 1-定时跳转,2-点击跳转,3-不跳转
|
||||
if (type === 1) {
|
||||
setTimeout(() => {
|
||||
this.$global.levelJump(pageLevel, url, params)
|
||||
}, jumpTime * 1000)
|
||||
} else if (type === 2) {
|
||||
this.$global.levelJump(pageLevel, url, params)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1735,8 +1766,8 @@ export default {
|
||||
|
||||
.swiper {
|
||||
position: absolute;
|
||||
left:20rpx;
|
||||
bottom:20rpx;
|
||||
left: 20rpx;
|
||||
bottom: 20rpx;
|
||||
width: 296rpx;
|
||||
height: 72rpx;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
return 718 / (this.mapData?.mapImageWidth || 1);
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
onLoad() {
|
||||
this.getNavList();
|
||||
},
|
||||
onReachBottom() {
|
||||
@@ -91,6 +91,7 @@ export default {
|
||||
<view class="search-box flex ai-center">
|
||||
<input type="text" v-model="keyword" placeholder="搜索商品" placeholder-style="color:#999"
|
||||
@confirm="search()"/>
|
||||
<image :src="webUrl+'/20231223183627184005.png'" mode="scaleToFill" style="width:30rpx;height:30rpx"/>
|
||||
</view>
|
||||
|
||||
<view class="map-box">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -198,39 +198,27 @@
|
||||
<text v-if="tempName">{{ tempName }}</text>
|
||||
<text>销量:{{ dayInfo.sales }}{{ dayInfo.unitName }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 优惠券选择开始 -->
|
||||
<!-- <view
|
||||
class="coupon acea-row row-between-wrapper"
|
||||
@click="couponTap"
|
||||
v-if="couponList.length"
|
||||
>
|
||||
<text class="hide line1 acea-row">
|
||||
<text>优惠券:</text>
|
||||
<text
|
||||
class="activity"
|
||||
v-for="(item, couponListEq) in couponList"
|
||||
:key="couponListEq"
|
||||
>满{{ item.use_min_price }}减{{ item.coupon_price }}</text>
|
||||
</text>
|
||||
<view class="iconfont icon-jiantou"></view>
|
||||
</view> -->
|
||||
<!-- 优惠券选择结束 -->
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 已选规格开始 -->
|
||||
<!-- <view class="attribute acea-row row-between-wrapper" @click="selecAttrTap">-->
|
||||
<!-- <view>-->
|
||||
<!-- <text>{{ attrTxt }}:</text>-->
|
||||
<!-- <text class="atterTxt">{{ attrValue }}</text>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="iconfont icon-jiantou"></view>-->
|
||||
<!-- </view>-->
|
||||
<!-- 已选规格结束 -->
|
||||
<!-- v9 优惠券开始 -->
|
||||
<u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons()">
|
||||
<CouponsPopup :two-list="couponList" @close="changeCoupons"/>
|
||||
</u-popup>
|
||||
<!-- v9 优惠券结束 -->
|
||||
|
||||
<!-- v6服务项目开始 -->
|
||||
<view class="service-section goods-section" v-if="storeInfo && storeInfo.isTickets!=1">
|
||||
<view class="cell flex jc-between ai-center" @click="changeCoupons()" v-if="couponList['usable'].length>0">
|
||||
<view>
|
||||
<text class="coupon-label tc" v-for="(item,index) in couponList.usable" :key="index" v-if="index<2">
|
||||
{{ item.couponTitle }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="value">优惠详情
|
||||
<uni-icons type="right" size="13" color="#707070"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cell flex jc-between ai-center" @click="selecAttrTap">
|
||||
<view class="flex ai-center">
|
||||
<view class="after-title">规格</view>
|
||||
@@ -459,7 +447,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop>
|
||||
<!-- <CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop>-->
|
||||
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cart_num"/>
|
||||
<StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
|
||||
:posterData="posterData" :goodId="id"></StorePoster>
|
||||
@@ -488,13 +476,12 @@
|
||||
<script>
|
||||
import ProductConSwiper from "@/components/ProductConSwiper";
|
||||
import UserEvaluation from "@/components/UserEvaluation";
|
||||
import CouponPop from "@/components/CouponPop";
|
||||
import ProductWindow from "@/components/ProductWindow";
|
||||
import StorePoster from "@/components/StorePoster";
|
||||
import ShareInfo from "@/components/ShareInfo";
|
||||
import CountDown from "@/components/CountDown";
|
||||
import {getCartCount, getProductCode, getProductDetail, postCartAdd} from "@/api/store";
|
||||
import {getCollectAdd, getCollectDel, getCoupon, userBindParent} from "@/api/user";
|
||||
import {userBindParent} from "@/api/user";
|
||||
import {handleQrCode, isWeixin} from "@/utils";
|
||||
import {getHomeData} from "@/api/public";
|
||||
import {getDailyGoods, getPreSale, getYxStoreSeckill} from "@/api/goods";
|
||||
@@ -503,6 +490,8 @@ import {diffDay, formatDateTime} from "@/utils/index";
|
||||
import {getCurAddress, getLocation, getUrlParam} from "@/utils/common.js";
|
||||
import cookie from "@/utils/store/cookie";
|
||||
import {famousGoodsShareImage, secKillGoodsShareImage} from "@/api/share";
|
||||
import CouponsPopup from "@/components/CouponsPopup.vue"
|
||||
import { formatContent } from '@/utils/util.js'
|
||||
|
||||
export default {
|
||||
name: "GoodsCon",
|
||||
@@ -510,10 +499,10 @@ export default {
|
||||
CountDown,
|
||||
ProductConSwiper,
|
||||
UserEvaluation,
|
||||
CouponPop,
|
||||
ProductWindow,
|
||||
StorePoster,
|
||||
ShareInfo
|
||||
ShareInfo,
|
||||
CouponsPopup
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
@@ -549,7 +538,7 @@ export default {
|
||||
killInfo: {},
|
||||
dayInfo: {},
|
||||
storeInfo: {},
|
||||
couponList: [],
|
||||
couponList: {},
|
||||
attrTxt: "请选择",
|
||||
attrValue: "",
|
||||
cart_num: 1, //购买数量
|
||||
@@ -581,7 +570,9 @@ export default {
|
||||
isWenwan: 0,
|
||||
postAddress: null,
|
||||
exSliceEnd: 3,
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
// v9-2
|
||||
show: false,
|
||||
};
|
||||
},
|
||||
computed: mapGetters(["isLogin", "location", "userInfo"]),
|
||||
@@ -597,12 +588,18 @@ export default {
|
||||
params += `&activityId=${this.activityId}`
|
||||
}
|
||||
|
||||
if (result.status === 200) {
|
||||
if (result?.status === 200) {
|
||||
resolve({
|
||||
title: this.storeInfo.storeName,
|
||||
path: '/pages/shop/GoodsCon/index' + params,
|
||||
imageUrl: result.data
|
||||
})
|
||||
} else {
|
||||
resolve({
|
||||
title: this.storeInfo.storeName,
|
||||
path: '/pages/shop/GoodsCon/index' + params,
|
||||
imageUrl: this.storeInfo.image
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -610,6 +607,7 @@ export default {
|
||||
// test data
|
||||
console.log("getLaunchOptionsSync", uni.getLaunchOptionsSync());
|
||||
console.log("getEnterOptionsSync", uni.getEnterOptionsSync());
|
||||
uni.removeStorageSync('couponId')
|
||||
|
||||
let url = handleQrCode();
|
||||
if (url && url.productId) {
|
||||
@@ -950,6 +948,10 @@ export default {
|
||||
if (this.$deviceType == "app") {
|
||||
from.from = "app";
|
||||
}
|
||||
if (that.source === 'kill') {
|
||||
from.seckillId = that.activityId
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
mask: true
|
||||
@@ -961,7 +963,7 @@ export default {
|
||||
// /\<img/gi,
|
||||
// '<img style="display:block;max-width:100%;height:auto;"'
|
||||
// );
|
||||
that.$set(that, "storeInfo", res.data.storeInfo);
|
||||
that.$set(that, "storeInfo", formatContent(res.data.storeInfo));
|
||||
that.isWenwan = res.data.isWenwan;
|
||||
|
||||
// 给 attr 赋值,将请求回来的规格赋值给 attr
|
||||
@@ -969,7 +971,11 @@ export default {
|
||||
that.$set(that.attr, "productAttr", res.data.productAttr);
|
||||
that.$set(that, "productValue", res.data.productValue);
|
||||
}
|
||||
that.attr.defaultSku = res.data.defaultSku
|
||||
that.attr.defaultSkuIndex = res.data.defaultSkuIndex
|
||||
|
||||
res.data.couponList['unusable']?.map(item => item.status = 2)
|
||||
that.$set(that, 'couponList', res.data.couponList)
|
||||
that.$set(that, "replyCount", res.data.replyCount);
|
||||
that.$set(that, "replyChance", res.data.replyChance);
|
||||
that.reply = res.data.reply ? [res.data.reply] : [];
|
||||
@@ -1028,11 +1034,14 @@ export default {
|
||||
let productAttr = this.attr.productAttr;
|
||||
let value = [];
|
||||
for (let i = 0; i < productAttr.length; i++) {
|
||||
this.$set(productAttr[i], "index", 0);
|
||||
value.push(productAttr[i].attrValueArr[0]);
|
||||
this.$set(productAttr[i], "index", this.attr.defaultSkuIndex[i]);
|
||||
value.push(productAttr[i].attrValueArr[1]);
|
||||
}
|
||||
//sort();排序函数:数字-英文-汉字;
|
||||
let productSelect = this.productValue[value.sort().join(",")];
|
||||
// let productSelect = this.productValue[value.sort().join(",")];
|
||||
|
||||
const skuKey = this.attr.defaultSku?.join(',')
|
||||
let productSelect = this.productValue[skuKey]
|
||||
if (productSelect && productAttr.length) {
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
@@ -1045,7 +1054,8 @@ export default {
|
||||
this.$set(this.attr.productSelect, "stock", productSelect.stock);
|
||||
this.$set(this.attr.productSelect, "unique", productSelect.unique);
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this, "attrValue", value.sort().join(","));
|
||||
// this.$set(this, "attrValue", value.sort().join(","));
|
||||
this.$set(this, "attrValue", skuKey);
|
||||
this.$set(this, "attrTxt", "已选择");
|
||||
} else if (!productSelect && productAttr.length) {
|
||||
this.$set(
|
||||
@@ -1121,33 +1131,7 @@ export default {
|
||||
let value = opt.value === undefined ? "" : opt.value;
|
||||
this[action] && this[action](value);
|
||||
},
|
||||
//打开优惠券插件;
|
||||
couponTap: function () {
|
||||
let that = this;
|
||||
that.coupons();
|
||||
that.coupon.coupon = true;
|
||||
},
|
||||
changecoupon: function (msg) {
|
||||
this.coupon.coupon = msg;
|
||||
this.coupons();
|
||||
},
|
||||
currentcoupon: function (res) {
|
||||
let that = this;
|
||||
that.coupon.coupon = false;
|
||||
that.$set(that.coupon.list[res], "is_use", true);
|
||||
},
|
||||
//可领取优惠券接口;
|
||||
coupons: function () {
|
||||
let that = this,
|
||||
q = {
|
||||
page: 1,
|
||||
limit: 20
|
||||
};
|
||||
getCoupon(q).then(res => {
|
||||
that.$set(that, "couponList", res.data || []);
|
||||
that.$set(that.coupon, "list", res.data);
|
||||
});
|
||||
},
|
||||
|
||||
//打开属性插件;
|
||||
selecAttrTap: function () {
|
||||
this.attr.cartAttr = true;
|
||||
@@ -1184,21 +1168,6 @@ export default {
|
||||
this.$set(this, "attrTxt", "请选择");
|
||||
}
|
||||
},
|
||||
//收藏商品
|
||||
setCollect: function () {
|
||||
let that = this,
|
||||
id = that.storeInfo.id,
|
||||
category = "product";
|
||||
if (that.storeInfo.userCollect) {
|
||||
getCollectDel(id, category).then(function () {
|
||||
that.storeInfo.userCollect = !that.storeInfo.userCollect;
|
||||
});
|
||||
} else {
|
||||
getCollectAdd(id, category).then(function () {
|
||||
that.storeInfo.userCollect = !that.storeInfo.userCollect;
|
||||
});
|
||||
}
|
||||
},
|
||||
// 点击加入购物车按钮
|
||||
joinCart: function () {
|
||||
if (this.isOpen === true && this.attr.productSelect.stock === 0) return;
|
||||
@@ -1322,7 +1291,11 @@ export default {
|
||||
},
|
||||
listenerActionClose: function () {
|
||||
this.posters = false;
|
||||
}
|
||||
},
|
||||
// v9-2
|
||||
changeCoupons() {
|
||||
this.show = !this.show
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
<template>
|
||||
<view class="shoppingCart">
|
||||
<!-- <hx-navbar
|
||||
title="购物车"
|
||||
:fixed="true"
|
||||
:back="false"
|
||||
:left-slot="false"
|
||||
:right-slot="false"
|
||||
color="#ffffff"
|
||||
statusBarFontColor="#ffffff"
|
||||
:bgImgHeight="bgImgHeight"
|
||||
:background-color="[254,82,97]"
|
||||
:background-img="webUrl+'/20200729160752671638.png'"/> -->
|
||||
<hx-navbar
|
||||
title="购物车"
|
||||
:fixed="true"
|
||||
@@ -31,28 +20,11 @@
|
||||
<view>
|
||||
<text class="num" style="color: #666666;">共{{ count }}件商品</text>
|
||||
</view>
|
||||
<!-- <view
|
||||
v-if="cartList.valid.length > 0"
|
||||
class="administrate acea-row row-center-wrapper font-color-white"
|
||||
@click="manage"
|
||||
>{{ footerswitch ? '取消' : '管理' }}</view> -->
|
||||
<view class="top-delete-btn acea-row row-middle" @click="delgoods">
|
||||
<image class="delete-icon" :src="webUrl+'/20210806133058078099.png'" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view style="border-top: 1px solid #f5f5f5" v-if="$store.getters.token||userInfo.uid">
|
||||
<!-- <view style="margin-top: 80rpx;" v-if="$store.getters.token||userInfo.uid"> -->
|
||||
<!-- <view class="labelNav acea-row row-around row-middle">
|
||||
<view class="item">
|
||||
<text class="iconfont icon-xuanzhong"></text>100%正品保证
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="iconfont icon-xuanzhong"></text>所有商品精挑细选
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="iconfont icon-xuanzhong"></text>售后无忧
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view v-if="validList.length > 0 || cartList.invalid.length > 0">
|
||||
<view class="list">
|
||||
@@ -529,6 +501,14 @@ export default {
|
||||
plus: function (index) {
|
||||
let that = this;
|
||||
let list = that.cartList.valid[index];
|
||||
if (list.cartNum + 1 > list.trueStock) {
|
||||
uni.showToast({
|
||||
title: '该商品库存不足,无法继续增加',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
list.cartNum++;
|
||||
if (list.attrInfo) {
|
||||
if (list.cartNum >= list.attrInfo.stock) {
|
||||
|
||||
+13
-36
@@ -218,6 +218,14 @@
|
||||
</view>
|
||||
<view class="serviceList acea-row row-middle">
|
||||
|
||||
<view class="item" @click="goCoupons()">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20231130162907823563.png'"/>
|
||||
</view>
|
||||
<view class="cell">我的优惠券</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
|
||||
<view class="item" @click="goGroupManage()">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20221010165555111608.png'"/>
|
||||
@@ -280,39 +288,13 @@
|
||||
<view class="cell">客服历史会话</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
<!-- <template v-for="(item, MyMenusIndex) in MyMenus">
|
||||
<view
|
||||
class="item"
|
||||
:key="MyMenusIndex"
|
||||
@click="goPages(MyMenusIndex)"
|
||||
>
|
||||
<view class="pictrue">
|
||||
<image :src="item.pic" />
|
||||
</view>
|
||||
<view class="cell">{{ item.name }}</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
</template> -->
|
||||
|
||||
|
||||
<!-- <view class="item" @click="goPages2()">
|
||||
<view class="pictrue"></view>
|
||||
<view class="cell">hexiao</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- 我的服务结束 -->
|
||||
|
||||
</view>
|
||||
<!-- <view class="by">
|
||||
<view>
|
||||
<text class="by-text">www.yixiang.co提供技术支持</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<uni-popup ref="popup" type="center">
|
||||
<!-- <view class="acea-row row-column row-middle" style="position: relative;background-color: #fff;width: 440rpx;border-radius: 20rpx;"> -->
|
||||
<view class="acea-row row-column row-middle"
|
||||
style="position: relative;background-color: #fff;border-radius: 20rpx;">
|
||||
<view class="acea-row row-center" style="border-radius: 50%;margin-top: -52rpx;background-color: #fff;">
|
||||
@@ -626,6 +608,11 @@ export default {
|
||||
// }
|
||||
// })
|
||||
},
|
||||
goCoupons() {
|
||||
uni.navigateTo({
|
||||
url: '/pkg_user/views/myCoupons'
|
||||
})
|
||||
},
|
||||
goGroupManage() {
|
||||
this.$yrouter.push("/pages/user/promotion/UserPromotion/index");
|
||||
},
|
||||
@@ -924,16 +911,6 @@ page {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.by {
|
||||
text-align: center;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.by-text {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(90deg, rgba(254, 150, 107, 1) 0%, rgba(255, 88, 75, 1) 100%);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user