This commit is contained in:
quantulr
2024-07-05 17:17:55 +08:00
parent 3560654b8e
commit 3eea25e2ba
5 changed files with 252 additions and 159 deletions

View File

@ -1,11 +1,11 @@
<wxs module="findGoods">
function findGoods(goodsList, id) {
<wxs module="findGoodsByName">
function findGoodsByName(goodsList, name, spec) {
// 初始化一个变量来存储找到的商品
var found = null;
// 遍历商品列表以查找具有指定ID的商品
for (var i = 0; i < goodsList.length; i++) {
if (goodsList[i].id === id) {
if (goodsList[i].goodsName === name && goodsList[i].wisdGoodsSpec.specName === spec) {
found = goodsList[i];
break;
}
@ -20,9 +20,10 @@
return undefined;
}
module.exports = {
findGoods: findGoods,
findGoodsByName: findGoodsByName,
}
</wxs>
<wxs module="num">
function toFixed(num, precise) {
return typeof (num) === "undefined" ? num : num.toFixed(precise)
@ -76,13 +77,13 @@
</view>
<view class="cont display_J_B" wx:for='{{item.goods}}' wx:key="specId" wx:for-item="goodsItem" catchtap="">
<view class="cont-l">
<image src="{{ goods.orderPayWay == 3? goods.goodsList[0].goodsPhoto: findGoods.findGoods(goods.goodsList,goodsItem.id).goodsPhoto }}"></image>
<image src="{{ goods.orderPayWay == 3? goods.goodsList[0].goodsPhoto: findGoodsByName.findGoodsByName(goods.goodsList,goodsItem.name,goodsItem.spec).goodsPhoto }}"></image>
</view>
<view class="cont-m">
<view class="name GStitleOne">{{goodsItem.name}}</view>
<view class="specs" wx:if="{{goods.orderPayWay!=3}}">规格:{{goodsItem.spec}}</view>
<view class="price" wx:if="{{goods.orderPayWay!=3}}">
{{goods.orderPayWay!=2?'¥'+findGoods.findGoods(goods.goodsList,goodsItem.id).price:findGoods.findGoods(goods.goodsList,goodsItem.id).price+'积分'}}
{{goods.orderPayWay!=2?'¥'+findGoodsByName.findGoodsByName(goods.goodsList,goodsItem.name,goodsItem.spec).wisdGoodsSpec.specPrice:findGoodsByName.findGoodsByName(goods.goodsList,goodsItem.name,goodsItem.spec).wisdGoodsSpec.specPrice+'积分'}}
</view>
<view class="price" wx:if="{{goods.orderPayWay==3}}">¥0</view>
</view>