diff --git a/pages/mall/order-info/index.js b/pages/mall/order-info/index.js index a149f28..1418891 100644 --- a/pages/mall/order-info/index.js +++ b/pages/mall/order-info/index.js @@ -179,6 +179,7 @@ Page({ const element = this.data.orderInfo.skuList[index]; if(this.checkSkuPrice(this.data.matchTag, element)){ this.data.form.unitPrice = Number(element.price) + this.data.form.stockNumber = Number(element.stockNumber) this.data.form.dividePrice = Number(element.dividePrice) this.data.form.skuId = element.id console.log(element) @@ -188,6 +189,8 @@ Page({ // 如果查询到了价格,进行价格计算 if(this.data.form.unitPrice){ this.setData({ + ['form.unitPrice']: this.data.form.unitPrice, + ['form.stockNumber']: this.data.form.stockNumber, amount: float.accMul(this.data.form.unitPrice, this.data.form.number) }) } @@ -210,6 +213,14 @@ Page({ return } } + if(this.data.form.number <= 0){ + util.showToast('请输入购买数量,必选大于0') + return + } + if(this.data.form.stockNumber <= 0){ + util.showToast('暂无库存,请选择其他规格类型') + return + } this.data.form.summary = this.data.orderInfo.summary this.data.form.sellMode = this.data.orderInfo.sellMode this.data.form.name = this.data.orderInfo.name diff --git a/pages/mall/order-info/index.wxml b/pages/mall/order-info/index.wxml index e8c7e4e..55254d8 100644 --- a/pages/mall/order-info/index.wxml +++ b/pages/mall/order-info/index.wxml @@ -12,8 +12,8 @@ - ¥{{orderInfo.price}} - 库存:{{orderInfo.stockNumber}}{{orderInfo.unit}} + ¥{{form.unitPrice || orderInfo.price}} + 库存:{{form.stockNumber >= 0 ? form.stockNumber : orderInfo.stockNumber}}{{orderInfo.unit}} {{orderInfo.viewNum}} 浏览 @@ -42,7 +42,7 @@ 购买数量 - + diff --git a/pages/mall/page-list/index.js b/pages/mall/page-list/index.js new file mode 100644 index 0000000..fdf0fab --- /dev/null +++ b/pages/mall/page-list/index.js @@ -0,0 +1,22 @@ +// pages/message/index.js + +Component({ + options: { + addGlobalClass: true, + multipleSlots: true + }, + properties: { + dataList: { // 必选,通知本组件收起 + type: Array, + value: null, + } + }, + methods: { + lookItem: function (e) { + var item = this.data.dataList[e.currentTarget.dataset.index] + wx.navigateTo({ + url: '/pages/mall/order-info/index?id=' + item.id + }) + } + } +}) \ No newline at end of file diff --git a/pages/mall/page-list/index.json b/pages/mall/page-list/index.json new file mode 100644 index 0000000..8dee24a --- /dev/null +++ b/pages/mall/page-list/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "wux-image": "/components/image/index" + } +} \ No newline at end of file diff --git a/pages/mall/page-list/index.wxml b/pages/mall/page-list/index.wxml new file mode 100644 index 0000000..1d598fd --- /dev/null +++ b/pages/mall/page-list/index.wxml @@ -0,0 +1,23 @@ + + + + + + + + + {{item.name}} + {{item.viewNum}} 浏览 + 已拼{{item.soldNum}}{{item.unit}} + + + {{item.outline}} + {{item.summary}} + + + ¥{{item.price}} + 库存:{{item.stockNumber}}{{item.unit}} + + + + \ No newline at end of file diff --git a/pages/mall/page-list/index.wxss b/pages/mall/page-list/index.wxss new file mode 100644 index 0000000..93b26bc --- /dev/null +++ b/pages/mall/page-list/index.wxss @@ -0,0 +1,76 @@ +/* pages/message/index.wxss */ + +.content { + margin-top: 24rpx; + background: rgba(255, 255, 255, 1); + border-radius: 6px; +} + +.page-icon { + height: 240rpx; + width: 240rpx; + border-top-left-radius: 12rpx; + border-bottom-left-radius: 12rpx; +} + +.page-name { + font-size: 16px; + font-family: PingFang-SC-Medium, PingFang-SC; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 22px; +} + +.page-num { + margin-top: 8rpx; + font-size: 10px; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(51, 51, 51, 1); +} + +.page-outline { + margin-top: 8rpx; + font-size: 10px; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(51, 51, 51, 1); + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + white-space: normal !important; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + +.page-btn { + height: 27px; + background: rgba(255, 66, 43, 1); + box-shadow: 0px 4px 14px -6px rgba(255, 43, 45, 0.8); + color: white; + font-size: 12px; +} + +.page-price { + font-size: 16px; + font-family: DINAlternate-Bold, DINAlternate; + font-weight: bold; + color: rgba(255, 66, 43, 1); +} + +.page-stock { + font-size: 10px; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(153, 153, 153, 1); + line-height: 14px; +} + +.image-load { + width: 240rpx; + height: 240rpx; + display: flex; + align-items: center; + justify-content: center; +} \ No newline at end of file diff --git a/pages/mall/search-list/index.json b/pages/mall/search-list/index.json index 3e2954b..896467f 100644 --- a/pages/mall/search-list/index.json +++ b/pages/mall/search-list/index.json @@ -3,6 +3,7 @@ "refresh-view": "/components/refresher/index", "wux-button": "/components/button/index", "wux-tab": "/components/tab/index", - "wux-image": "/components/image/index" + "wux-image": "/components/image/index", + "page-list": "/pages/mall/page-list/index" } } \ No newline at end of file diff --git a/pages/mall/search-list/index.wxml b/pages/mall/search-list/index.wxml index 19238e7..d29e828 100644 --- a/pages/mall/search-list/index.wxml +++ b/pages/mall/search-list/index.wxml @@ -37,29 +37,7 @@ - - - - - - - - - {{item.name}} - 已拼{{item.soldNum}}{{item.unit}} - {{item.viewNum}} 浏览 - - - {{item.outline}} - {{item.summary}} - - - ¥{{item.price}} - 库存:{{item.stockNumber}}{{item.unit}} - - - - + diff --git a/pages/mall/search-list/index.wxss b/pages/mall/search-list/index.wxss index acc8db5..fe184a7 100644 --- a/pages/mall/search-list/index.wxss +++ b/pages/mall/search-list/index.wxss @@ -32,78 +32,3 @@ .cu-bar .search-form [class*="cuIcon-"]::before { top: 0rpx; } - -.content { - margin-top: 24rpx; - background: rgba(255, 255, 255, 1); - border-radius: 6px; -} - -.page-icon { - height: 240rpx; - width: 240rpx; - border-top-left-radius: 12rpx; - border-bottom-left-radius: 12rpx; -} - -.page-name { - font-size: 16px; - font-family: PingFang-SC-Medium, PingFang-SC; - font-weight: 500; - color: rgba(51, 51, 51, 1); - line-height: 22px; -} - -.page-num { - margin-top: 8rpx; - font-size: 10px; - font-family: PingFang-SC-Regular, PingFang-SC; - font-weight: 400; - color: rgba(51, 51, 51, 1); -} - -.page-outline { - margin-top: 8rpx; - font-size: 10px; - font-family: PingFang-SC-Regular, PingFang-SC; - font-weight: 400; - color: rgba(51, 51, 51, 1); - display: -webkit-box; - overflow: hidden; - text-overflow: ellipsis; - word-wrap: break-word; - white-space: normal !important; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; -} - -.page-btn { - height: 27px; - background: rgba(255, 66, 43, 1); - box-shadow: 0px 4px 14px -6px rgba(255, 43, 45, 0.8); - color: white; - font-size: 12px; -} - -.page-price { - font-size: 16px; - font-family: DINAlternate-Bold, DINAlternate; - font-weight: bold; - color: rgba(255, 66, 43, 1); -} - -.page-stock { - font-size: 10px; - font-family: PingFang-SC-Regular, PingFang-SC; - font-weight: 400; - color: rgba(153, 153, 153, 1); - line-height: 14px; -} - -.image-load { - width: 240rpx; - height: 240rpx; - display: flex; - align-items: center; - justify-content: center; -} diff --git a/pages/mall/shops/index.json b/pages/mall/shops/index.json index bf85060..6cfe557 100644 --- a/pages/mall/shops/index.json +++ b/pages/mall/shops/index.json @@ -9,6 +9,7 @@ "wux-button": "/components/button/index", "wux-tab": "/components/tab/index", "wux-image": "/components/image/index", - "wux-divider": "/components/divider/index" + "wux-divider": "/components/divider/index", + "page-list": "/pages/mall/page-list/index" } } \ No newline at end of file diff --git a/pages/mall/shops/index.wxml b/pages/mall/shops/index.wxml index f601268..dcb8457 100644 --- a/pages/mall/shops/index.wxml +++ b/pages/mall/shops/index.wxml @@ -110,28 +110,7 @@ 限时限量 售完即止 - - - - - - - - - {{item.name}} - {{item.viewNum}} 浏览 - - - {{item.outline}} - {{item.summary}} - - - ¥{{item.price}} - 库存:{{item.stockNumber}}{{item.unit}} - - - - + @@ -142,28 +121,7 @@ - - - - - - - - - {{item.name}} - 已拼{{item.soldNum}}{{item.unit}} - - - {{item.outline}} - {{item.summary}} - - - ¥{{item.price}} - 库存:{{item.stockNumber}}{{item.unit}} - - - - + diff --git a/pages/mall/shops/index.wxss b/pages/mall/shops/index.wxss index bde0996..4b65da2 100644 --- a/pages/mall/shops/index.wxss +++ b/pages/mall/shops/index.wxss @@ -74,78 +74,4 @@ font-weight: 400; color: rgba(208, 208, 208, 1); } - -.content { - margin-top: 24rpx; - background: rgba(255, 255, 255, 1); - border-radius: 6px; -} - -.page-icon { - height: 240rpx; - width: 240rpx; - border-top-left-radius: 12rpx; - border-bottom-left-radius: 12rpx; -} - -.page-name { - font-size: 16px; - font-family: PingFang-SC-Medium, PingFang-SC; - font-weight: 500; - color: rgba(51, 51, 51, 1); - line-height: 22px; -} - -.page-num { - margin-top: 8rpx; - font-size: 10px; - font-family: PingFang-SC-Regular, PingFang-SC; - font-weight: 400; - color: rgba(51, 51, 51, 1); -} - -.page-outline { - margin-top: 8rpx; - font-size: 10px; - font-family: PingFang-SC-Regular, PingFang-SC; - font-weight: 400; - color: rgba(51, 51, 51, 1); - display: -webkit-box; - overflow: hidden; - text-overflow: ellipsis; - word-wrap: break-word; - white-space: normal !important; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; -} - -.page-btn { - height: 27px; - background: rgba(255, 66, 43, 1); - box-shadow: 0px 4px 14px -6px rgba(255, 43, 45, 0.8); - color: white; - font-size: 12px; -} - -.page-price { - font-size: 16px; - font-family: DINAlternate-Bold, DINAlternate; - font-weight: bold; - color: rgba(255, 66, 43, 1); -} - -.page-stock { - font-size: 10px; - font-family: PingFang-SC-Regular, PingFang-SC; - font-weight: 400; - color: rgba(153, 153, 153, 1); - line-height: 14px; -} - -.image-load { - width: 240rpx; - height: 240rpx; - display: flex; - align-items: center; - justify-content: center; -} \ No newline at end of file + \ No newline at end of file