From c037848d0f98218ba70d62fc8942add47f7bacb6 Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Fri, 27 May 2022 19:59:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E8=AE=A2=E5=8D=95=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=8E=A5=E5=8F=A3=E3=80=81=E5=AE=8C=E5=96=84=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=BE=AE=E4=BF=A1=E6=8E=A5=E5=8F=A3=E3=80=81=E8=B0=83?= =?UTF-8?q?=E5=8F=96=E5=AE=AB=E6=A0=BC=E6=8E=A5=E5=8F=A3=E3=80=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=AE=A2=E5=8D=95=E6=8F=90=E4=BA=A4=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E6=93=8D=E4=BD=9C=E3=80=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 2 +- .../gong-ge/gong-ge-function.vue | 5 +++- components/shopping-carts/cart-slide.vue | 18 +++++++++---- components/status-navs/status-nav.vue | 9 ++++++- jsFile/public-api.js | 18 +++++++++++-- pages/tabbar/cart/cart.vue | 3 +++ pages/tabbar/cate/cate.vue | 26 ++++++++++++++++--- pages/tabbar/my/my.vue | 13 +++++----- pages/tabbar/pagehome/pagehome.vue | 11 +++++++- pagesB/finish/finish.vue | 17 ++++++++---- pagesB/settlement/settlement.vue | 24 +++++++++++++---- pagesB/shop-detail/shop-detail.vue | 7 +++++ store/modules/moduleA.js | 6 ++++- 13 files changed, 127 insertions(+), 32 deletions(-) diff --git a/App.vue b/App.vue index f6fcd3a..8499d24 100644 --- a/App.vue +++ b/App.vue @@ -5,7 +5,7 @@ projectname:'', // 项目名称 lat:'', // 公司地址维度 lng:'' ,// 公司地址经度 - hostapi:'http://caimall.scdxtc.cn' // 域名配置 + hostapi:'https://caimall.scdxtc.cn' // 域名配置 }, // 优先于show方法 onLaunch: function() { diff --git a/components/function-list/gong-ge/gong-ge-function.vue b/components/function-list/gong-ge/gong-ge-function.vue index 1f6ad0f..986519a 100644 --- a/components/function-list/gong-ge/gong-ge-function.vue +++ b/components/function-list/gong-ge/gong-ge-function.vue @@ -78,8 +78,11 @@ // 找图标高度最大值 maxHeight() { let arr = []; + let max = ''; this.list.forEach(item=>{arr.push(item.iconHeight);}) - let max = arr.reduce((a,b)=>{return b > a ? b : a}) + if(arr.length) { + max = arr.reduce((a,b)=>{return b > a ? b : a}) + } return max; }, }, diff --git a/components/shopping-carts/cart-slide.vue b/components/shopping-carts/cart-slide.vue index 0a9bdf1..a72e056 100644 --- a/components/shopping-carts/cart-slide.vue +++ b/components/shopping-carts/cart-slide.vue @@ -178,6 +178,7 @@ id: item.id, spuId:item.spu.id, skuId:item.sku_id, + coding:item.sku.coding, image: item.spu.spu_cover, title: item.spu.spu_name, content: item.spu.unit, @@ -220,13 +221,20 @@ } else { // 去结算 console.log('去结算'); - this.$requst.post('/api/order/create').then(res=>{ - if(res.code==0) { - // uni.navigateTo({ - // url:'/pagesB/settlement/settlement' - // }) + let buyList = []; + this.listData.forEach(item=>{ + if(item.ifcheck) { + let obj = { + sku_coding: item.coding, + num: item.num + } + buyList.push(obj); } }) + uni.setStorageSync('buyList',buyList); + uni.navigateTo({ + url:'/pagesB/settlement/settlement' + }) } }, // 选中事件 diff --git a/components/status-navs/status-nav.vue b/components/status-navs/status-nav.vue index 620c8dd..f80f538 100644 --- a/components/status-navs/status-nav.vue +++ b/components/status-navs/status-nav.vue @@ -132,7 +132,14 @@ }, //返回事件 backEv(){ - uni.navigateBack({delta:1}) + uni.navigateBack({ + delta:1, + fail: () => { + uni.reLaunch({ + url:'/pages/tabbar/pagehome/pagehome' + }) + } + }) } } } diff --git a/jsFile/public-api.js b/jsFile/public-api.js index 299cb78..f52a35f 100644 --- a/jsFile/public-api.js +++ b/jsFile/public-api.js @@ -9,7 +9,7 @@ export function themeEv(){ return requst.get('/api/index/mini-program-setting').then(res=>{ if(res.code==0){ let list = []; - if(res.data.footBar.length!=0){//底部导航 + if(res.data.footBar.length){//底部导航 res.data.footBar.forEach(item=>{ let obj = { iconPath: item.icon, @@ -20,6 +20,20 @@ export function themeEv(){ }) store.commit('updateState', {list}) } + let geList = []; + if(res.data.recommend.length){//底部导航 + res.data.recommend.forEach((item,index)=>{ + let obj = { + url:item.link, + iconsrc:item.icon, + iconWidth:[48,56,64,48,56,58,48,44,54,52][index], + iconHeight:[50,54,46,48,58,52,54,56,50,52][index], + title:item.name + } + geList.push(obj); + }) + store.commit('setGe', {geList}) + } } }) } @@ -27,7 +41,7 @@ export function themeEv(){ export function getCartNum(){ return requst.get('/api/order/shopping-cart-count').then(res=>{ if(res.code==0){ - store.commit('setNum', 9) + store.commit('setNum', res.data.count) } }) } \ No newline at end of file diff --git a/pages/tabbar/cart/cart.vue b/pages/tabbar/cart/cart.vue index 256d479..077099e 100644 --- a/pages/tabbar/cart/cart.vue +++ b/pages/tabbar/cart/cart.vue @@ -27,6 +27,9 @@ onReachBottom() { this.$refs.cart.getList(); }, + onShow() { + uni.removeStorageSync('buyList'); + }, onLoad(op) { if(op.skuId) this.skuId = op.skuId; }, diff --git a/pages/tabbar/cate/cate.vue b/pages/tabbar/cate/cate.vue index 27992d0..379e223 100644 --- a/pages/tabbar/cate/cate.vue +++ b/pages/tabbar/cate/cate.vue @@ -77,6 +77,7 @@ // {id:1,title:'推荐套装'}, // {id:1,title:'推荐套装'}, ], + activeIndex:0, secendCateList:[ {title:'标题一'}, {title:'标题二标题二'}, @@ -88,7 +89,6 @@ {title:'标题八'}, {title:'标题九'}, ], - activeIndex:0, dataList:[ // {imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg', title:'标题',price:199}, // {imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg', title:'标题标题标题标题标题标题标题',price:20000}, @@ -117,7 +117,6 @@ }), }, onLoad(op) { - console.log(this.footHeight); this.scrollHeight = this.scrollHeight - this.footHeight; if(op.index) { this.current = op.index; @@ -155,7 +154,7 @@ }, // 查询左侧分类列表 checkShopCate(){ - this.$requst.post('/api/spu/category').then(res=>{ + this.$requst.post('/api/spu/category',{hasChildren:1}).then(res=>{ if(res.code==0) { this.cateList = res.data; setTimeout(()=>{ @@ -166,6 +165,9 @@ }).exec() },200) this.pid = this.cateList[0].id; + if(this.cateList[0].child) { + this.secendCateList = this.cateList[0].child; + } this.checkShopList(this.cateList[0].id); } }) @@ -182,6 +184,24 @@ this.current = index; this.page = 1; this.pid = id; + // if(this.activeIndex>this.cateList[index].child.length-1) { + // this.activeIndex = this.cateList[index].child.length-1; + // } + if(this.cateList[index].child) { + this.secendCateList = this.cateList[index].child; + } else { + this.secendCateList = [ + {title:'标题一'}, + {title:'标题二标题二'}, + {title:'标题三'}, + {title:'标题四'}, + {title:'标题五'}, + {title:'标题六标题六标题六'}, + {title:'标题七'}, + {title:'标题八'}, + {title:'标题九'}, + ] + } this.checkShopList(id); }, goDetail(id) { diff --git a/pages/tabbar/my/my.vue b/pages/tabbar/my/my.vue index 568cbf6..6f83029 100644 --- a/pages/tabbar/my/my.vue +++ b/pages/tabbar/my/my.vue @@ -24,9 +24,9 @@ - + - + @@ -75,7 +75,7 @@ {url:'/pagesB/business-profile/business-profile',iconsrc:'/static/public/icon-aboutus.png',iconWidth:34,iconHeight:32,title:'商家简介',content:'',contentColor:'#999999',ifNext:true}, ], ifWx:false, - imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg', + imgsrc:'', userImg:'', userName:'', addwxcontent:'' @@ -99,7 +99,7 @@ this.$requst.get('/api/index/add-wechat').then(res=>{ if(res.code==0) { this.addwxcontent = this.$toolAll.tools.escape2Html(res.data.content); - this.imgsrc = getApp().globalData.hostapi + res.data.wechat; + this.imgsrc = res.data.wechat; } }) }, @@ -109,8 +109,8 @@ if(res.code==0) { this.userImg = res.data.headimgurl; this.userName = res.data.nickname; - this.list[0].num = res.data.order_count.paid; - this.list[1].num = res.data.order_count.waiting; + this.list[0].num = res.data.order_count.order_placed; + this.list[1].num = res.data.order_count.makeing; this.list[2].num = res.data.order_count.shipped; } @@ -131,7 +131,6 @@ uni.navigateTo({ url:`/pagesA/order-list/order-list?index=${[1,2,3,4][obj.index]}` }) - console.log(obj); }, // 保存二维码 saveImg(){ diff --git a/pages/tabbar/pagehome/pagehome.vue b/pages/tabbar/pagehome/pagehome.vue index 9613a19..df60449 100644 --- a/pages/tabbar/pagehome/pagehome.vue +++ b/pages/tabbar/pagehome/pagehome.vue @@ -13,7 +13,7 @@ - + @@ -32,6 +32,7 @@ import listOne from '@/components/list/list-one'; import customerOne from '@/components/customer/customer-one'; import {slidePosition} from '@/jsFile/public-api.js'; + import { mapState } from 'vuex'//引入mapState export default { components:{ 'foot-tab' :footTab, @@ -62,6 +63,14 @@ playTimer:null, bannerList:[] } + }, + computed:{ + ...mapState({ + geList: state => state.moduleA.geList, + }), + }, + onShareAppMessage() { + }, onReachBottom(e) { this.$refs.listhome.moreEv(); diff --git a/pagesB/finish/finish.vue b/pagesB/finish/finish.vue index e0c8797..7425a57 100644 --- a/pagesB/finish/finish.vue +++ b/pagesB/finish/finish.vue @@ -8,10 +8,11 @@ 已完成提交 - 请扫描二维码添加微信告知您的订单
+ +
保存二维码 继续购物 @@ -25,11 +26,17 @@ export default { data() { return { - imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg' + imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg', + richText:'' } }, - onLoad() { - + onLoad(op) { + this.$requst.get('/api/order/orderQrCode',{id:op.id}).then(res=>{ + if(res.code==0) { + this.imgsrc = res.data.path; + this.richText = this.$toolAll.tools.escape2Html(res.data.content); + } + }) }, methods: { // 提交 diff --git a/pagesB/settlement/settlement.vue b/pagesB/settlement/settlement.vue index 29234eb..00706c4 100644 --- a/pagesB/settlement/settlement.vue +++ b/pagesB/settlement/settlement.vue @@ -17,15 +17,15 @@
- 收货地址 + 收货地址(必填) - 收货联系人 + 收货联系人(必填) - 收货电话 + 收货电话(必填) 提交完成 @@ -56,8 +56,22 @@ submit(){ if(this.checkEmpty() && this.flag){ this.flag = false; - uni.navigateTo({ - url:'/pagesB/finish/finish' + let params = { + sku_list: uni.getStorageSync('buyList'), + phone: this.phone, + contacts: this.name, + address: this.address, + expected_delivery_date: this.totime, + wedding_date: this.lasttime, + } + this.$requst.post('/api/order/create',params).then(res=>{ + if(res.code==0) { + uni.reLaunch({ + url:`/pagesB/finish/finish?id=${res.data.id}` + }) + } else { + this.$toolAll.tools.showToast(res.msg); + } }) } }, diff --git a/pagesB/shop-detail/shop-detail.vue b/pagesB/shop-detail/shop-detail.vue index 6832328..e1ec662 100644 --- a/pagesB/shop-detail/shop-detail.vue +++ b/pagesB/shop-detail/shop-detail.vue @@ -45,6 +45,13 @@ onHide() { clearTimeout(this.playTimer); }, + onShareAppMessage() { + return { + title:'', + path:`/pagesB/shop-detail/shop-detail?id=${this.shopObj.id}`, + imageUrl:'' + } + }, onShow() { this.playTimer = setTimeout(()=>{ this.isplay = true; diff --git a/store/modules/moduleA.js b/store/modules/moduleA.js index 6c5e538..bfdd6aa 100644 --- a/store/modules/moduleA.js +++ b/store/modules/moduleA.js @@ -25,13 +25,17 @@ export default { titleList:[], imgList:[], onLineList:[], - cartNum:0 + cartNum:0, + geList:[] }, // Vuex中store数据改变的唯一方法就是mutations 不适合异步方法 mutations: { setNum(state,num){ state.cartNum = num; }, + setGe(state,payload){ + state.geList = payload.geList; + }, footHeightEv(state,str){ state.footHeight = str; },