From e742f65a6322fce3e41348a09323d842bda6efd1 Mon Sep 17 00:00:00 2001 From: initwithout Date: Thu, 4 May 2023 14:21:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 3 +- pages/aftersales/asdetail.wxml | 166 ++++++++--------- pages/aftersales/index.wxml | 10 +- pages/cart/cart.js | 306 ++++++++++++++++++++++++++++++- pages/cart/cart.wxml | 43 ++++- pages/cart/cart.wxss | 182 ++++++++++++++++++ pages/collection/collection.wxss | 15 +- pages/index/index.js | 3 +- pages/index/index.wxml | 2 +- pages/member/member.wxml | 16 +- pages/notice/index.json | 2 +- pages/notice/index.wxml | 10 +- pages/notice/index.wxss | 10 + pages/notice/notice.json | 2 +- pages/notice/notice.wxml | 13 +- pages/notice/notice.wxss | 55 ++++-- pages/product/detail.js | 1 - pages/set/set.wxml | 2 +- pages/set/set.wxss | 11 +- pages/similar/similar.js | 85 +++++++++ pages/similar/similar.json | 4 + pages/similar/similar.wxml | 53 ++++++ pages/similar/similar.wxss | 55 ++++++ pages/store/store.js | 112 ++++++++++- utils/server.js | 10 +- 25 files changed, 1020 insertions(+), 151 deletions(-) create mode 100644 pages/similar/similar.js create mode 100644 pages/similar/similar.json create mode 100644 pages/similar/similar.wxml create mode 100644 pages/similar/similar.wxss diff --git a/app.json b/app.json index cdd6154..c2ecc39 100644 --- a/app.json +++ b/app.json @@ -53,7 +53,8 @@ "pages/aftersales/aftersales", "pages/aftersales/index", "pages/aftersales/apply", - "pages/aftersales/asdetail" + "pages/aftersales/asdetail", + "pages/similar/similar" ], "window": { "backgroundTextStyle": "light", diff --git a/pages/aftersales/asdetail.wxml b/pages/aftersales/asdetail.wxml index 15a8d7d..a778be1 100644 --- a/pages/aftersales/asdetail.wxml +++ b/pages/aftersales/asdetail.wxml @@ -1,88 +1,88 @@ - - 待审核 - 您的售后申请正在审核中,请耐心等待2-3个工作日 - - - 待回寄 - 商家已同意,请用户寄回商品 - - - 已拒绝 - 商家拒绝退货退款 - - - 待卖家收货 - 用户已寄出,等待商家收货 - - - 已退款 - 收到寄回商品,同意并退款 - - - 已拒绝 - 商家拒绝并退回商品 - - - 已拒绝 - 商家拒绝退款 - - - 已退款 - 商家同意并退款 - - - 已拒绝 - 商家拒绝售后 - - - 待收货 - 商家同意并且寄回商品 - - - 已结束 - 售后结束 - - + + 待审核 + 您的售后申请正在审核中,请耐心等待2-3个工作日 + + + 待回寄 + 商家已同意,请用户寄回商品 + + + 已拒绝 + 商家拒绝退货退款 + + + 待卖家收货 + 用户已寄出,等待商家收货 + + + 已退款 + 收到寄回商品,同意并退款 + + + 已拒绝 + 商家拒绝并退回商品 + + + 已拒绝 + 商家拒绝退款 + + + 已退款 + 商家同意并退款 + + + 已拒绝 + 商家拒绝售后 + + + 待收货 + 商家同意并且寄回商品 + + + 已结束 + 售后结束 + + - - - 售后信息 - - - - 商品名称: - {{info.p_name}} - - - 订单号: - {{info.r_sNo}} - - - 申请时间: - {{info.re_time}} - - - 售后类型: - {{info.re_type==1?'退货退款':info.re_type==3?'换货':'仅退款'}} - - - 申请原因: - {{info.content}} - - - 上传凭证: - - - - - - - - 退款金额: - ¥{{info.p_price}} - + + + 售后信息 + + + + 商品名称: + {{info.p_name}} + + + 订单号: + {{info.r_sNo}} + + + 申请时间: + {{info.re_time}} + + + 售后类型: + {{info.re_type==1?'退货退款':info.re_type==3?'换货':'仅退款'}} + + + 申请原因: + {{info.content}} + + + 上传凭证: + + + - \ No newline at end of file + + + + 退款金额: + ¥{{info.p_price}} + + + \ No newline at end of file diff --git a/pages/aftersales/index.wxml b/pages/aftersales/index.wxml index 6410cab..645b4e9 100644 --- a/pages/aftersales/index.wxml +++ b/pages/aftersales/index.wxml @@ -56,13 +56,13 @@ - - - + + + {{item.re_type==2?'仅退款':item.re_type==1?'退货退款':'换货'}} - + 查看详情 - 撤销审核 + 撤销审核 diff --git a/pages/cart/cart.js b/pages/cart/cart.js index defa9eb..f256ea0 100644 --- a/pages/cart/cart.js +++ b/pages/cart/cart.js @@ -7,12 +7,21 @@ Page({ minusStatuses: ['disabled', 'disabled', 'normal', 'normal', 'disabled'], total: 0.0, carts: [], + data: {}, + skuBeanList: [], cont: 1, upstatus: false, remind: '加载中', productData: '', shop: '', shop_logo: '', + showModalStatus: false, + animationData: '', + buynum: 1, + attrList: [], + sizeid: '', + currentIndex: 0, + itemData: {} }, //页面加载完成函数 remind: '加载中', onReady: function () { @@ -462,7 +471,6 @@ Page({ }); that.sum(); } - } else { wx.showToast({ title: '数量不能小于1,请重新输入!', @@ -477,4 +485,300 @@ Page({ }; }, + showAttribute: function(e) { + var productId = e.currentTarget.dataset.id; + var index = e.currentTarget.dataset.index; + var that = this; + that.loadProductDetail(productId); + var animation = wx.createAnimation({ + duration: 200, + timingFunction: "linear", + delay: 0 + }); + this.animation = animation + animation.translateY(300).step(); + this.setData({ + // paytype: type, + animationData: animation.export(), + currentIndex: index + }) + if (e.currentTarget.dataset.status == 1) { + this.setData({ + showModalStatus: true + }); + } + setTimeout(function () { + animation.translateY(0).step() + this.setData({ + animationData: animation + }) + if (e.currentTarget.dataset.status == 0) { + this.setData({ + showModalStatus: false + }); + } + }.bind(this), 200); + }, + // 商品详情数据获取 + loadProductDetail: function (productId) { + var that = this; + WXAPI.productIndex({ // productAttribute + accessId: app.globalData.accessId, + storeId: 239, + storeType: 1, + pro_id: productId, + // cart_id: productId + }).then(res => { + if (res.code == 200) { + var data = res.data; + var pro = data.pro; + that.setData({ + skuBeanList: data.skuBeanList, + // itemData: pro, + attrList: data.attrList, + sizeid: data.attrList[0].attr[0].attrId, + }); + //默认选中 + that.one(); + } + }); + }, + //首次进去选中 + one: function () { + var attrListIn = this.data.attrList; + var skuBeanListIn = this.data.skuBeanList; + var select_list = skuBeanListIn[0]; + for (var i = 0; i < attrListIn.length; i++) { + for (var j = 0; j < attrListIn[i].attr.length; j++) { + for (var b = 0; b < select_list.attributes.length; b++) { + if (select_list.attributes[b].attributeId == attrListIn[i].attr[j].attributeId && select_list.attributes[b].attributeValId == attrListIn[i].attr[j].id) { + attrListIn[i].attr[j].select = true; + } + } + } + } + var itemData = this.data.itemData; + itemData.photo_x = select_list.imgurl; + itemData.price_yh = select_list.price; + itemData.num = select_list.count; + var sizeid = select_list.cid; + + // 重新赋值 + this.setData({ + attrList: attrListIn, + skuBeanList: skuBeanListIn, + itemData: itemData, + sizeid: sizeid, + value: select_list.name + }) + this.onData(); + }, + // 弹窗 + setModalStatus: function (e) { + var animation = wx.createAnimation({ + duration: 200, + timingFunction: "linear", + delay: 0 + }); + //定义点击的类型 + var type = e.target.dataset.type ? e.target.dataset.type : false; + //控制两种不同显示方式 + if (type) { + this.setData({ + xefl: false, + }) + } else { + this.setData({ + xefl: true, + }) + type = this.data.paytype; + } + this.animation = animation + animation.translateY(300).step(); + this.setData({ + paytype: type, + animationData: animation.export() + }) + if (e.currentTarget.dataset.status == 1) { + this.setData({ + showModalStatus: true + }); + } + setTimeout(function () { + animation.translateY(0).step() + this.setData({ + animationData: animation + }) + if (e.currentTarget.dataset.status == 0) { + this.setData({ + showModalStatus: false + }); + } + }.bind(this), 200) + }, + /** + * 规格属性点击事件 + */ + onChangeShowState: function (event) { + var that = this; + var listItem = this.data.attrList; + var items = listItem[event.currentTarget.dataset.idx]; + var item = items.attr[event.currentTarget.dataset.index]; + if (!item.enable) { + return; + } + var select = !item.select; + for (var i = 0; i < items.attr.length; i++) { + items.attr[i].select = false; + } + item.select = select; + // 获取点击属性列表 + var canGetInfo = []; + for (var skuIndex = 0; skuIndex < listItem.length; skuIndex++) { + for (var skuIndexIn = 0; skuIndexIn < listItem[skuIndex].attr.length; skuIndexIn++) { + if (listItem[skuIndex].attr[skuIndexIn].enable && listItem[skuIndex].attr[skuIndexIn].select) { + canGetInfo.push(listItem[skuIndex].attr[skuIndexIn]); + } + } + } + var canGetInfoLog = ""; + var skuBeanList = this.data.skuBeanList; + var haveSkuBean = []; + // 对应库存清单扫描 + for (var skuBeanIndex = 0; skuBeanIndex < skuBeanList.length; skuBeanIndex++) { + var iListCount = 0; + for (var skuBeanIndexIn = 0; skuBeanIndexIn < skuBeanList[skuBeanIndex].attributes.length; skuBeanIndexIn++) { + if (canGetInfo.length == skuBeanList[skuBeanIndex].attributes.length) { + if (skuBeanList[skuBeanIndex].attributes[skuBeanIndexIn].attributeValId == canGetInfo[skuBeanIndexIn].id) { + iListCount++; + } + } else { + canGetInfoLog = "库存清单不存在此属性" + " "; + } + } + if (iListCount == skuBeanList[skuBeanIndex].attributes.length) { + haveSkuBean.push(skuBeanList[skuBeanIndex]); + } + } + for (var iox = 0; iox < canGetInfo.length; iox++) { + canGetInfoLog += canGetInfo[iox].attributeValue + " "; + } + if (haveSkuBean.length != 0) { + //选中设置 + var itemData = that.data.itemData; + itemData.photo_x = haveSkuBean[0].imgurl; + itemData.price_yh = haveSkuBean[0].price; + itemData.num = haveSkuBean[0].count; + var choujiangid = that.data.choujiangid; + var sizeid = haveSkuBean[0].cid; + that.setData({ + itemData: itemData, + sizeid: sizeid, + choujiangid: choujiangid, + value: canGetInfoLog + }); + } else { + that.setData({ + sizeid: '', + value: '' + }); + } + // 重新赋值 + this.setData({ + attrList: listItem, + infoText: canGetInfoLog, + }) + // 重新sku运算 + this.onData(); + }, + /** + * Sku核心算法 + * 根据所有出当前类别之外的选择 判断按钮的enable ? false or true + */ + onData: function () { + var attrListIn = this.data.attrList; + for (var i = 0; i < attrListIn.length; i++) { + var attrListBig = attrListIn[i]; + + //当前类别之外的选择列表 + var attrsOtherSelect = []; + for (var j = 0; j < attrListIn.length; j++) { + var attrListSmall = attrListIn[j]; + if (attrListSmall.id != attrListBig.id) { + for (var k = 0; k < attrListSmall.attr.length; k++) { + var attrListSmallAttr = attrListSmall.attr[k]; + if (attrListSmallAttr.enable && attrListSmallAttr.select) { + attrsOtherSelect.push(attrListSmallAttr); + } + } + } + } + + var enableIds = []; + + var skuBeanListIn = this.data.skuBeanList; + + for (var z = 0; z < skuBeanListIn.length; z++) { + var ism = true; + var skuBean = skuBeanListIn[z]; + + for (var j = 0; j < attrsOtherSelect.length; j++) { + var enable = false; + for (var k = 0; k < skuBean.attributes.length; k++) { + + var goodAttrBean = skuBean.attributes[k]; + if (attrsOtherSelect[j].attributeId == goodAttrBean.attributeId + && attrsOtherSelect[j].id == goodAttrBean.attributeValId) { + enable = true; + break; + } + } + ism = enable && ism; + } + + if (ism) { + for (var o = 0; o < skuBean.attributes.length; o++) { + var goodAttrBean = skuBean.attributes[o]; + + if (attrListBig.id == goodAttrBean.attributeId) { + enableIds.push(goodAttrBean.attributeValId); + } + } + } + } + + var integers = enableIds; + for (var s = 0; s < attrListBig.attr.length; s++) { + var attrItem = attrListBig.attr[s]; + attrItem.enable = integers.indexOf(attrItem.id) != -1; + } + } + + // 重新赋值 + this.setData({ + attrList: attrListIn, + skuBeanList: skuBeanListIn + }) + }, + confirmAct: function (e) { + var that = this; + var carts = that.data.carts; + var index = that.data.currentIndex; + var cartId = carts[index].id; + WXAPI.modifyAttribute({ + accessId: app.globalData.accessId, + storeId: 239, + storeType: 1, + cart_id: cartId, + attribute_id: that.data.sizeid + }).then(res => { + if (res.code == 200) { + that.setData({ + showModalStatus: false + }); + that.loadProductData(); + } + }); + + }, }) \ No newline at end of file diff --git a/pages/cart/cart.wxml b/pages/cart/cart.wxml index 2cdabdc..2838a21 100644 --- a/pages/cart/cart.wxml +++ b/pages/cart/cart.wxml @@ -71,11 +71,10 @@ - - {{item.pro_name}} - [{{item.skuBeanList[0].name}}] - - + + {{item.pro_name}} + [{{item.skuBeanList[0].name}}] + ¥ {{item.price}} @@ -104,7 +103,39 @@ 删除 立即结算 - + + + + × + + + + + + ¥ {{itemData.price_yh}} + 库存:{{itemData.num}} + + + + + + + + {{item.attrName}} + + + + {{items.attributeValue}} + + + + + + + 确定 + + + \ No newline at end of file diff --git a/pages/cart/cart.wxss b/pages/cart/cart.wxss index 468b214..ff5abf4 100644 --- a/pages/cart/cart.wxss +++ b/pages/cart/cart.wxss @@ -397,4 +397,186 @@ padding-right:16px; width: 25rpx; height: 25rpx; margin-left: 20rpx; +} +/*弹窗*/ +.drawer_screen { + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + background: #000; + opacity: 0.2; + overflow: hidden; + z-index: 1; + color: #fff; +} + +.drawer_attr_box { + width: 100%; + height: 50%; + border-radius:10px 10px 0 0; + position: fixed; + bottom: 0; + left: 0; + z-index: 2000; + background: #fff; +} + +.close_icon { + width: 60rpx; + height: 60rpx; + line-height: 60rpx; + font-size: 60rpx; + position: absolute; + right: 5rpx; + top:5rpx; + padding: 10rpx; + color: #ccc; + /*border: 1rpx solid #ccc;*/ + border-radius: 50%; + text-align: center; + background: #fff; + z-index: 999; +} +.drawer_attr_content { + padding: 20rpx; + height:85%; + /* overflow-y: scroll; */ +} +.text_center{ + width: 97%; + position: absolute; + top: -40px; +} +.mingcheng{ + width: 65%; + font-size:35rpx; + line-height: 50rpx; + float: right; + margin-bottom:20px; +} +.drawer_image { + width: 28%; + height: 200rpx; + border:1px solid #ddd; + border-radius:10rpx; +} + +.drawer_desc{ + font-size:28rpx; + margin:20rpx; + height: 150rpx; + width: 100%; +} +/*每组属性的主盒子*/ +.attr_box { + width: 100%; + overflow: hidden; + border-bottom: 1rpx solid #ececec; +} +/*属性名*/ +.attr_name { + width: 20%; + float: left; + padding: 15rpx 0; + font-size: 30rpx; + margin-top:20rpx; +} +.outStyle { + display: flex; + flex-direction: column; +} + +.outStyleText { + display: flex; + flex-direction: column; + color: #999; +} +.typeStyle { + display: flex; + flex-direction: row; + margin: 10px; +} +.textStyle { + font-size:14px; +} +.buttonPaddingStyle { + padding-left:10px; + padding-right:10px; + padding-top:5px; + padding-bottom:5px; + margin-bottom:5px; +} +/*数量*/ +.dian{ + position: absolute; + right: 30rpx; +} +.shu{ + display: flex; + flex-direction: row; + width: 100%; + margin-top: 30rpx; + height: 100rpx; +} +.stepper { + text-align: right; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + width: 200rpx; + overflow: hidden; + margin-left: 250rpx; + background-color: #F8F8F8; + border-top: 1px solid #DDD; + border-bottom: 1px solid #DDD; + border-radius: 8rpx; +} +.stepper text { + border-left: 1px solid #DDD; + border-right: 1px solid #DDD; + width: 25px; + height: 25px; + line-height: 25px; + text-align: center; + font-weight: 900; +} +.stepper input { + width: 30px; + height: 25px; + text-align: center; +} +.normal { + /* background-color: #f5f5f5; */ + color: #000; +} +.cun{ + /* margin: 5px; */ + font-size:30rpx; + /* padding-left: 20rpx; */ + width: 20% +} +.select { + border-radius: 10px; + background-color: #FB5657; + margin-right: 10px; + color: #fff; +} +.footc{ + display:block; + position:fixed; + bottom:0; + left:0; + background:#FB5657; + z-index:100; + width:100%; + font-size:14px; + border-top:1px solid #eee; + line-height:40px; + font-weight:700; + color:snow; + text-align: center; + background:#FB5657; } \ No newline at end of file diff --git a/pages/collection/collection.wxss b/pages/collection/collection.wxss index 7bcede9..f207fc7 100644 --- a/pages/collection/collection.wxss +++ b/pages/collection/collection.wxss @@ -19,15 +19,16 @@ float: left; } .sp_text{ - float: left; - line-height: 20px; - width: 100%; - height:100%; + margin-left: 10rpx; + line-height: 20px; + width: 100%; + height:100%; } .sp_tit{ - width: 100%; - overflow: hidden; - font-size: 14px; + margin-top: 15rpx; + width: 100%; + overflow: hidden; + font-size: 14px; } .sp_neb{ width: 100%; diff --git a/pages/index/index.js b/pages/index/index.js index a3389f8..73f9964 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -227,8 +227,9 @@ Page({ //找相似 discoverSimilarProducts: function (e) { var goodsId = e.currentTarget.dataset; + console.log(goodsId) wx.navigateTo({ - // url:"/pages/detail/detail?id="+goodsId.id + url:"/pages/similar/similar?id="+goodsId.id }) }, navToShopList: function (e) { diff --git a/pages/index/index.wxml b/pages/index/index.wxml index acbec51..10e0b8d 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -227,7 +227,7 @@ {{list.mch_name}} - + 找相似 diff --git a/pages/member/member.wxml b/pages/member/member.wxml index b835317..e5bdc8e 100644 --- a/pages/member/member.wxml +++ b/pages/member/member.wxml @@ -1,7 +1,13 @@ - - 当前积分0,充值会员即可拥有积分特权 - - - + + 当前积分0,充值会员即可拥有积分特权 + + + + \ No newline at end of file diff --git a/pages/notice/index.json b/pages/notice/index.json index 634a3f3..1bf6e8f 100644 --- a/pages/notice/index.json +++ b/pages/notice/index.json @@ -1,5 +1,5 @@ { "component": true, "usingComponents": {}, - "navigationBarTitleText": "公告详情" + "navigationBarTitleText": "消息详情" } \ No newline at end of file diff --git a/pages/notice/index.wxml b/pages/notice/index.wxml index edbdde3..c752b32 100644 --- a/pages/notice/index.wxml +++ b/pages/notice/index.wxml @@ -1,16 +1,14 @@ - - {{notice.title}} - - {{notice.time}} + {{notice.title}} + {{notice.time}} - + - +