1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

通过微信开发者工具 商城模板 创建新小程序

This commit is contained in:
2023-03-06 23:52:24 +08:00
parent ada464a8cc
commit c21ff901d5
393 changed files with 52952 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
var isOnlyBack = function (data) {
return data.limitGoodsList || (data.inValidGoodsList && !data.storeGoodsList);
};
var isShowChangeAddress = function (data) {
return data.abnormalDeliveryGoodsList;
};
var isShowKeepPay = function (data) {
return data.outOfStockGoodsList || (data.storeGoodsList && data.inValidGoodsList);
};
module.exports = {
isOnlyBack: isOnlyBack,
isShowChangeAddress: isShowChangeAddress,
isShowKeepPay: isShowKeepPay,
};

View File

@@ -0,0 +1,57 @@
Component({
properties: {
settleDetailData: {
type: Object,
value: {},
observer(settleDetailData) {
const {
outOfStockGoodsList,
abnormalDeliveryGoodsList,
inValidGoodsList,
limitGoodsList,
} = settleDetailData;
// 弹窗逻辑 限购 超出配送范围 失效 库存不足;
const tempList =
limitGoodsList ||
abnormalDeliveryGoodsList ||
inValidGoodsList ||
outOfStockGoodsList ||
[];
tempList.forEach((goods, index) => {
goods.id = index;
goods.unSettlementGoods &&
goods.unSettlementGoods.forEach((ele) => {
ele.name = ele.goodsName;
ele.price = ele.payPrice;
ele.imgUrl = ele.image;
});
});
this.setData({
// settleDetailData,
goodsList: tempList,
});
},
},
},
data: {
goodList: [],
},
methods: {
onCard(e) {
const { item } = e.currentTarget.dataset;
if (item === 'cart') {
// 购物车
Navigator.gotoPage('/cart');
} else if (item === 'orderSure') {
// 结算页
this.triggerEvent('change', undefined);
}
},
onDelive() {
// 修改配送地址
Navigator.gotoPage('/address', { type: 'orderSure' });
},
},
});

View File

@@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"wr-order-card": "/pages/order/components/order-card/index",
"wr-goods-card": "/components/goods-card/index",
"wr-order-goods-card": "/pages/order/components/order-goods-card/index"
}
}

View File

@@ -0,0 +1,53 @@
<wxs src="./noGood.wxs" module="order" />
<view class="goods-fail">
<block wx:if="{{settleDetailData.limitGoodsList && settleDetailData.limitGoodsList.length >0}}">
<view class="title">限购商品信息</view>
<view class="info">以下商品限购数量,建议您修改商品数量</view>
</block>
<block
wx:elif="{{settleDetailData.abnormalDeliveryGoodsList && settleDetailData.abnormalDeliveryGoodsList.length >0}}"
>
<view class="title">不支持配送</view>
<view class="info">以下店铺的商品不支持配送,请更改地址或去掉对应店铺商品再进行结算</view>
</block>
<block wx:elif="{{order.isShowKeepPay(settleDetailData)}}">
<view class="title">部分商品库存不足或失效</view>
<view class="info">请返回购物车重新选择商品,如果继续结算将自动忽略库存不足或失效的商品。</view>
</block>
<block wx:elif="{{settleDetailData.inValidGoodsList && settleDetailData.inValidGoodsList.length > 0}}">
<view class="title">全部商品库存不足或失效</view>
<view class="info">请返回购物车重新选择商品</view>
</block>
<scroll-view
scroll-y="true"
style="max-height: 500rpx"
bindscrolltoupper="upper"
bindscrolltolower="lower"
bindscroll="scroll"
>
<view class="goods-list" wx:for="{{goodsList}}" wx:for-item="goods" wx:key="index">
<wr-order-card wx:if="{{goods}}" order="{{goods}}">
<wr-order-goods-card
wx:for="{{goods.unSettlementGoods}}"
wx:key="id"
wx:for-item="goods"
wx:for-index="gIndex"
goods="{{goods}}"
no-top-line="{{gIndex === 0}}"
/>
</wr-order-card>
</view>
</scroll-view>
<view class="goods-fail-btn">
<view bindtap="onCard" data-item="cart" class="btn {{order.isOnlyBack(settleDetailData) ? 'limit' : ''}}">
返回购物车
</view>
<view wx:if="{{order.isShowChangeAddress(settleDetailData)}}" bindtap="onDelive" class="btn origin">
修改配送地址
</view>
<view wx:elif="{{order.isShowKeepPay(settleDetailData)}}" bindtap="onCard" data-item="orderSure" class="btn origin">
继续结算
</view>
</view>
</view>

View File

@@ -0,0 +1,68 @@
/* 层级定义
@z-index-0: 1;
@z-index-1: 100;
@z-index-2: 200;
@z-index-5: 500;
@z-index-component: 1000; // 通用组件级别
@z-index-dropdown: @z-index-component;
@z-index-sticky: @z-index-component + 20;
@z-index-fixed: @z-index-component + 30;
@z-index-modal-backdrop:@z-index-component + 40;
@z-index-modal:@z-index-component + 50;
@z-index-popover:@z-index-component + 60;
@z-index-tooltip:@z-index-component + 70;
*/
/* var() css变量适配*/
.goods-fail {
display: block;
background: #fff;
font-size: 30rpx;
border-radius: 20rpx 20rpx 0 0;
}
.goods-fail .title {
display: inline-block;
width: 100%;
text-align: center;
margin-top: 30rpx;
line-height: 42rpx;
font-weight: bold;
font-size: 32rpx;
}
.goods-fail .info {
display: block;
font-size: 26rpx;
font-weight: 400;
line-height: 36rpx;
margin: 20rpx auto 10rpx;
text-align: center;
width: 560rpx;
color: #999;
}
.goods-fail .goods-fail-btn {
display: flex;
padding: 30rpx;
justify-content: space-between;
align-items: center;
font-size: 30rpx;
}
.goods-fail .goods-fail-btn .btn {
width: 330rpx;
height: 80rpx;
line-height: 80rpx;
border-radius: 8rpx;
text-align: center;
border: 1rpx solid #999;
background: #fff;
font-size: 32rpx;
color: #666;
}
.goods-fail .goods-fail-btn .btn.origin,
.goods-fail .goods-fail-btn .btn.limit {
color: #fa550f;
color: var(--color-primary, #fa550f);
border: 1rpx solid #fa550f;
border: 1rpx solid var(--color-primary, #fa550f);
}
.goods-fail .goods-fail-btn .btn.limit {
flex-grow: 1;
}