添加:商品详情及购买流程修改 - 兼容积分商品可用使用积分+现金进行购买

This commit is contained in:
wuhui_zzw 2023-09-11 17:56:16 +08:00
parent 9a73f6a4e5
commit 0116317c59
8 changed files with 90 additions and 22 deletions

View File

@ -73,6 +73,7 @@ Component({
popStock: 0, popStock: 0,
// 价格 // 价格
popPrice: 0, popPrice: 0,
popMoney: 0,
popThumb: "", // 商品图片 popThumb: "", // 商品图片
optionsMaxCount: 1, optionsMaxCount: 1,
submitActionTag: "-2", submitActionTag: "-2",
@ -265,8 +266,10 @@ Component({
} }
let popPrice = ""; let popPrice = "";
let popMoney = 0;
if (this.data.goods_plugin.point_goods) { if (this.data.goods_plugin.point_goods) {
popPrice = this.data.goods_plugin.point_goods.point_option[_activeSkuIndex].goods_point; //设置默认价格 popPrice = this.data.goods_plugin.point_goods.point_option[_activeSkuIndex].goods_point; //设置默认价格
popMoney = this.data.goods_plugin.point_goods.point_option[_activeSkuIndex].use_money; //设置默认价格
} else { } else {
popPrice = this.data.goodsInfo.has_many_options[_activeSkuIndex].product_price; //设置默认价格 popPrice = this.data.goodsInfo.has_many_options[_activeSkuIndex].product_price; //设置默认价格
} }
@ -277,6 +280,7 @@ Component({
popupSpecs: true, popupSpecs: true,
popupModeshow: false, popupModeshow: false,
popPrice: popPrice, //设置价格 popPrice: popPrice, //设置价格
popMoney: popMoney,
popThumb: app._isTextEmpty(this.data.goodsInfo.has_many_options[_activeSkuIndex].thumb) ? this.data.goodsInfo.thumb : this.data.goodsInfo.has_many_options[_activeSkuIndex].thumb, //设置图片 popThumb: app._isTextEmpty(this.data.goodsInfo.has_many_options[_activeSkuIndex].thumb) ? this.data.goodsInfo.thumb : this.data.goodsInfo.has_many_options[_activeSkuIndex].thumb, //设置图片
popStock: this.data.goodsInfo.has_many_options[_activeSkuIndex].stock, //设置库存 popStock: this.data.goodsInfo.has_many_options[_activeSkuIndex].stock, //设置库存
optionsId: this.data.goodsInfo.has_many_options[_activeSkuIndex].id, //设置规格ID用于生成订单 optionsId: this.data.goodsInfo.has_many_options[_activeSkuIndex].id, //设置规格ID用于生成订单
@ -286,14 +290,17 @@ Component({
//初始化弹窗view //初始化弹窗view
initPopView() { initPopView() {
let popPrice = ""; let popPrice = "";
let popMoney = 0;
if (this.data.goodsInfo.has_option == 1) { if (this.data.goodsInfo.has_option == 1) {
if (this.data.goods_plugin.point_goods) { if (this.data.goods_plugin.point_goods) {
popPrice = this.data.goods_plugin.point_goods.min_point + "-" + this.data.goods_plugin.point_goods.max_point; //设置默认价格 popPrice = this.data.goods_plugin.point_goods.min_point + "-" + this.data.goods_plugin.point_goods.max_point; //设置默认价格
popMoney = this.data.goods_plugin.point_goods.use_moeny; //设置默认价格
} else { } else {
popPrice = this.data.goodsInfo.min_price + "-" + this.data.goodsInfo.max_price; //设置默认价格 popPrice = this.data.goodsInfo.min_price + "-" + this.data.goodsInfo.max_price; //设置默认价格
} }
this.setData({ this.setData({
popPrice: popPrice, //设置默认价格 popPrice: popPrice, //设置默认价格
popMoney: popMoney,
popThumb: this.data.goodsInfo.thumb, //设置默认图片 popThumb: this.data.goodsInfo.thumb, //设置默认图片
popStock: this.data.goodsInfo.stock, //设置默认库存 popStock: this.data.goodsInfo.stock, //设置默认库存
goodsDescription: "选择", goodsDescription: "选择",
@ -317,6 +324,7 @@ Component({
if (this.data.goods_plugin.point_goods) { if (this.data.goods_plugin.point_goods) {
popPrice = this.data.goods_plugin.point_goods.point; //设置默认价格 popPrice = this.data.goods_plugin.point_goods.point; //设置默认价格
popMoney = this.data.goods_plugin.point_goods.use_money;
} else { } else {
popPrice = this.data.goodsInfo.price; //设置默认价格 popPrice = this.data.goodsInfo.price; //设置默认价格
} }
@ -324,6 +332,7 @@ Component({
popThumb: this.data.goodsInfo.thumb, //设置默认图片 popThumb: this.data.goodsInfo.thumb, //设置默认图片
popStock: this.data.goodsInfo.stock, //设置默认库存 popStock: this.data.goodsInfo.stock, //设置默认库存
popPrice: popPrice, //设置默认价格 popPrice: popPrice, //设置默认价格
popMoney: popMoney,
goodsDescription: "", goodsDescription: "",
optionsMaxCount: this.data.goodsInfo.stock, optionsMaxCount: this.data.goodsInfo.stock,
skuImages: __optionArr2, skuImages: __optionArr2,
@ -678,6 +687,7 @@ Component({
setGoodsSpecsChangeInfo() { setGoodsSpecsChangeInfo() {
let specsManage = this.data.specsManage; let specsManage = this.data.specsManage;
let popPrice = ""; let popPrice = "";
let popMoney = 0;
//根据ID 排序 specsManage.sort(); //根据ID 排序 specsManage.sort();
specsManage.sort(function (a, b) { specsManage.sort(function (a, b) {
return a.id - b.id; return a.id - b.id;
@ -692,12 +702,14 @@ Component({
if (goodsSpecs == this.setGoodsSpecsBySort(this.data.goodsInfo.has_many_options[i].specs)) { if (goodsSpecs == this.setGoodsSpecsBySort(this.data.goodsInfo.has_many_options[i].specs)) {
if (this.data.goods_plugin.point_goods) { if (this.data.goods_plugin.point_goods) {
popPrice = this.data.goods_plugin.point_goods.point_option[i].goods_point; //设置默认价格 popPrice = this.data.goods_plugin.point_goods.point_option[i].goods_point; //设置默认价格
popMoney = this.data.goods_plugin.point_goods.point_option[i].use_money; //设置默认价格
} else { } else {
popPrice = this.data.goodsInfo.has_many_options[i].product_price; //设置默认价格 popPrice = this.data.goodsInfo.has_many_options[i].product_price; //设置默认价格
} }
this.setData({ this.setData({
activeSkuIndex: i, activeSkuIndex: i,
popPrice: popPrice, //设置价格 popPrice: popPrice, //设置价格
popMoney: popMoney,
popThumb: app._isTextEmpty(this.data.goodsInfo.has_many_options[i].thumb) ? this.data.goodsInfo.thumb : this.data.goodsInfo.has_many_options[i].thumb, //设置图片 popThumb: app._isTextEmpty(this.data.goodsInfo.has_many_options[i].thumb) ? this.data.goodsInfo.thumb : this.data.goodsInfo.has_many_options[i].thumb, //设置图片
popStock: this.data.goodsInfo.has_many_options[i].stock, //设置库存 popStock: this.data.goodsInfo.has_many_options[i].stock, //设置库存
optionsId: this.data.goodsInfo.has_many_options[i].id, //设置规格ID用于生成订单 optionsId: this.data.goodsInfo.has_many_options[i].id, //设置规格ID用于生成订单

View File

@ -28,6 +28,11 @@
</view> </view>
<view class="right"> <view class="right">
<view class="price" wx:if="{{goods_plugin.point_goods}}"> <view class="price" wx:if="{{goods_plugin.point_goods}}">
<text wx:if="{{popMoney > 0}}">
<text id="option_price">{{popMoney}}</text>
<text class="point-text" style="font-size: 13px">元</text>
<text id="option_price">+</text>
</text>
<text id="option_price">{{popPrice}}</text> <text id="option_price">{{popPrice}}</text>
<text class="point-text" style="font-size: 13px">{{integral}}</text> <text class="point-text" style="font-size: 13px">{{integral}}</text>
</view> </view>
@ -102,6 +107,11 @@
</view> </view>
<view class="right"> <view class="right">
<view class="price" wx:if="{{goods_plugin.point_goods}}"> <view class="price" wx:if="{{goods_plugin.point_goods}}">
<text wx:if="{{popMoney > 0}}">
<text id="option_price">{{popMoney}}</text>
<text class="point-text" style="font-size: 13px">元</text>
<text id="option_price">+</text>
</text>
<text id="option_price">{{popPrice}}</text> <text id="option_price">{{popPrice}}</text>
<text class="point-text" style="font-size: 13px">{{integral}}</text> <text class="point-text" style="font-size: 13px">{{integral}}</text>
</view> </view>

View File

@ -30,8 +30,9 @@
<icon class="iconfont icon-goods_kefu"></icon> <icon class="iconfont icon-goods_kefu"></icon>
</view> </view>
</van-goods-action-icon> </van-goods-action-icon>
<van-goods-action-button type="warning" text="加入购物车" bindtap="addCart" disabled="{{!isAddCart}}"
wx:if="{{ !debtId && !nocart && !isBegTime && !activityid && goodsInfo && goodsInfo.plugin_id != 72 && goodsType !== 'appointment_goods'&& goodsType!='store_projects_goods' && goodsType !== 'yunqian_api' && goods_plugin.is_special != 1 && goodsInfo.plugin_id != 140}}" /> <van-goods-action-button type="warning" text="加入购物车" bindtap="addCart" disabled="{{!isAddCart}}" wx:if="{{ !debtId && !nocart && !isBegTime && !activityid && goodsInfo && goodsInfo.plugin_id != 72 && goodsType !== 'appointment_goods'&& goodsType!='store_projects_goods' && goodsType !== 'yunqian_api' && goods_plugin.is_special != 1 && goodsInfo.plugin_id != 140 && !goods_plugin.point_goods}}" />
<block wx:if="{{!isRent}}"> <block wx:if="{{!isRent}}">
<van-goods-action-button type="danger" text="立即购买" disabled="{{is_yz_supplyGoods}}" wx:if="{{!isBuy || isTime}}" <van-goods-action-button type="danger" text="立即购买" disabled="{{is_yz_supplyGoods}}" wx:if="{{!isBuy || isTime}}"
catchtap="buyNow" /> catchtap="buyNow" />

View File

@ -16,13 +16,31 @@
<block wx:if="{{goods_plugin.point_goods}}"> <block wx:if="{{goods_plugin.point_goods}}">
<!-- goods_plugin.point_goods积分商城 ==> 积分全抵扣 不显示其他价格或者爱心值--> <!-- goods_plugin.point_goods积分商城 ==> 积分全抵扣 不显示其他价格或者爱心值-->
<view class="goods-price-box"> <view class="goods-price-box">
<text class="goods-price-num"> <!-- 金额 -->
<text class="goods-price-num-style-2">{{ goodsInfo.has_option == 1 ? (goods_plugin.point_goods.min_point == goods_plugin.point_goods.max_point ? <view style="display:inline-block;" wx:if="{{goods_plugin.point_goods.use_money > 0}}">
goods_plugin.point_goods.min_point : goods_plugin.point_goods.min_point + "-" + goods_plugin.point_goods.max_point) : goods_plugin.point_goods.point <text class="goods-price-num" style="margin-right:0 !important;">
}}</text> <text class="goods-price-num-style-2">{{ goods_plugin.point_goods.use_money }}</text>
</text>
<text class="goods-price-text">元</text>
</view>
<!-- 加号 -->
<text class="goods-price-num" wx:if="{{goods_plugin.point_goods.use_money > 0 && goods_plugin.point_goods.point > 0}}" style="margin: 0 10rpx !important;">
<text class="goods-price-num-style-2">+</text>
</text> </text>
<text class="goods-price-text">{{integral}}</text> <!-- 积分 -->
<text class="goods-price-text" wx:if="{{isRent}}">/天</text> <view style="display:inline-block;" wx:if="{{goods_plugin.point_goods.point > 0}}">
<text class="goods-price-num" style="margin-right:0 !important;">
<text class="goods-price-num-style-2">{{ goods_plugin.point_goods.point }}</text>
</text>
<text class="goods-price-text">{{integral}}</text>
<!-- <text class="goods-price-num" style="margin-right:0 !important;">
<text class="goods-price-num-style-2">
{{ goodsInfo.has_option == 1 ? (goods_plugin.point_goods.min_point == goods_plugin.point_goods.max_point ? goods_plugin.point_goods.min_point : goods_plugin.point_goods.min_point + "~" + goods_plugin.point_goods.max_point) : goods_plugin.point_goods.point }}
</text>
</text>
<text class="goods-price-text">{{integral}}</text>
<text class="goods-price-text" wx:if="{{isRent}}">/天</text>-->
</view>
</view> </view>
</block> </block>

View File

@ -875,7 +875,8 @@ Component({
skuImages: __optionArr2, skuImages: __optionArr2,
}); });
} }
} else if (this.data.goodsType == "grabGroup") { }
else if (this.data.goodsType == "grabGroup") {
// 抢团的初始化 // 抢团的初始化
try { try {
this.setData({ this.setData({
@ -917,11 +918,14 @@ Component({
optionsMaxCount: this.data.gooddatas.stock, optionsMaxCount: this.data.gooddatas.stock,
}); });
} }
} else { }
else {
let popPrice = ""; let popPrice = "";
let popMoney = 0;
if (this.data.goodsInfo.has_option == 1) { if (this.data.goodsInfo.has_option == 1) {
if (this.data.goods_plugin.point_goods) { if (this.data.goods_plugin.point_goods) {
popPrice = this.data.goods_plugin.point_goods.min_point + "-" + this.data.goods_plugin.point_goods.max_point; //设置默认价格 popPrice = this.data.goods_plugin.point_goods.min_point + "-" + this.data.goods_plugin.point_goods.max_point; //设置默认价格
popMoney = this.data.goods_plugin.point_goods.use_money; //设置默认价格
} else { } else {
popPrice = this.data.goodsInfo.min_price + "-" + this.data.goodsInfo.max_price; //设置默认价格 popPrice = this.data.goodsInfo.min_price + "-" + this.data.goodsInfo.max_price; //设置默认价格
} }
@ -940,6 +944,7 @@ Component({
popStock: this.data.goodsInfo.stock, popStock: this.data.goodsInfo.stock,
popThumb: this.data.goodsInfo.thumb, popThumb: this.data.goodsInfo.thumb,
popPrice: popPrice, popPrice: popPrice,
popMoney: popMoney,
goodsDescription: "选择", goodsDescription: "选择",
optionsMaxCount: this.data.goodsInfo.stock, optionsMaxCount: this.data.goodsInfo.stock,
skuImages: _optionArr, skuImages: _optionArr,
@ -950,6 +955,7 @@ Component({
if (this.data.goods_plugin.point_goods) { if (this.data.goods_plugin.point_goods) {
popPrice = this.data.goods_plugin.point_goods.point; //设置默认价格 popPrice = this.data.goods_plugin.point_goods.point; //设置默认价格
popMoney = this.data.goods_plugin.point_goods.use_money;
} else { } else {
popPrice = this.data.goodsInfo.price; //设置默认价格 popPrice = this.data.goodsInfo.price; //设置默认价格
} }
@ -958,6 +964,7 @@ Component({
popStock: this.data.goodsInfo.stock, popStock: this.data.goodsInfo.stock,
popThumb: this.data.goodsInfo.thumb, popThumb: this.data.goodsInfo.thumb,
popPrice: popPrice, popPrice: popPrice,
popMoney: popMoney,
goodsDescription: "", goodsDescription: "",
optionsMaxCount: this.data.goodsInfo.stock, optionsMaxCount: this.data.goodsInfo.stock,
skuImages: __optionArr2, skuImages: __optionArr2,

View File

@ -291,6 +291,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log('=== 调试中... ===',options);
wx.getStorage({ wx.getStorage({
key: "yz_basic_info", key: "yz_basic_info",
success: (res) => { success: (res) => {

View File

@ -28,5 +28,5 @@
"city-delivery-day":"../../mycomponent/city-delivery-day/city-delivery-day", "city-delivery-day":"../../mycomponent/city-delivery-day/city-delivery-day",
"invoice-pop":"../../mycomponent/invoice-pop/invoice-pop", "invoice-pop":"../../mycomponent/invoice-pop/invoice-pop",
"agency-saleman": "../../mycomponent/agency-saleman/agency-saleman" "agency-saleman": "../../mycomponent/agency-saleman/agency-saleman"
} }
} }

View File

@ -496,22 +496,41 @@
<view wx:if="{{reserve_deduction_love}}" class="dResrve"> <view wx:if="{{reserve_deduction_love}}" class="dResrve">
预约扣除<view class="span" >{{ reserve_deduction_love }}{{ love_name }}</view> 预约扣除<view class="span" >{{ reserve_deduction_love }}{{ love_name }}</view>
</view> </view>
<!-- 抵扣信息 -->
<block wx:if="{{item.order_deductions}}"> <block wx:if="{{item.order_deductions}}">
<view class="score list" wx:for="{{item.order_deductions}}" wx:for-item="d" wx:for-index="dindex" wx:key="dindex"> <view class="score list" wx:for="{{item.order_deductions}}" wx:for-item="d" wx:for-index="dindex" wx:key="dindex">
<view class="left"> <!--积分抵扣-->
可用{{d.coin}}{{d.name || integral}} <block wx:if="{{d.code == 'point'}}">
<text class="span">{{deduction_lang?deduction_lang:'抵扣'}}{{d.amount}}{{language['元']}}</text> <block wx:if="{{d.coin > 0 && d.amount <= 0}}">
</view> <view class="left">需要额外支付{{d.coin}}{{d.name || integral}}</view>
<view class="right"> </block>
<van-switch size='23px' data-orindex="{{orindex}}" loading="{{clicktag == 1}}" active-color="#ee0a24" data-dindex="{{dindex}}" checked="{{d.checked}}" bind:change="discountHandle" data-tag="discount" /> <block wx:else>
</view> <view class="left">
可用{{d.coin}}{{d.name || integral}}
<text class="span">{{deduction_lang?deduction_lang:'抵扣'}}{{d.amount}}{{language['元']}}</text>
</view>
<view class="right">
<van-switch size='23px' data-orindex="{{orindex}}" loading="{{clicktag == 1}}" active-color="#ee0a24" data-dindex="{{dindex}}" checked="{{d.checked}}" bind:change="discountHandle" data-tag="discount" />
</view>
</block>
</block>
<!--其他抵扣-->
<block wx:else>
<view class="left">
可用{{d.coin}}{{d.name || integral}}
<text class="span">{{deduction_lang?deduction_lang:'抵扣'}}{{d.amount}}{{language['元']}}</text>
</view>
<view class="right">
<van-switch size='23px' data-orindex="{{orindex}}" loading="{{clicktag == 1}}" active-color="#ee0a24" data-dindex="{{dindex}}" checked="{{d.checked}}" bind:change="discountHandle" data-tag="discount" />
</view>
</block>
</view> </view>
</block> </block>
<blcok wx:if="{{item.order_coin_exchanges}}" wx:for-item="d" wx:for-index="dindex" wx:key="dindex" wx:for="{{item.order_coin_exchanges}}"> <blcok wx:if="{{item.order_coin_exchanges}}" wx:for-item="d" wx:for-index="dindex" wx:key="dindex" wx:for="{{item.order_coin_exchanges}}">
<view class="score list" wx:if="{{!d.no_show}}"> <view class="score list" wx:if="{{!d.no_show}}">
<view class="left "> <view class="left ">
{{ d.coin }}{{d.name || integral}} {{ d.name ? '' : '需要支付' }}{{ d.coin }}{{d.name || integral}}
<text class="span">{{deduction_lang?deduction_lang:'抵扣'}}{{ d.amount }}{{language['元']}}</text> <text class="span" wx:if="{{d.amount > 0}}">{{deduction_lang?deduction_lang:'抵扣'}}{{ d.amount }}{{language['元']}}</text>
</view> </view>
<view class="right"> <view class="right">
</view> </view>