diff --git a/components/lf-indexFind/lf-indexFind.vue b/components/lf-indexFind/lf-indexFind.vue index a34a732..5f293d7 100644 --- a/components/lf-indexFind/lf-indexFind.vue +++ b/components/lf-indexFind/lf-indexFind.vue @@ -5,7 +5,7 @@ {{ item.associate.content }} diff --git a/pages.json b/pages.json index 3361ac6..7be0500 100644 --- a/pages.json +++ b/pages.json @@ -15,7 +15,8 @@ { "path": "pages/business/payment/paystate", "style": { - "navigationStyle": "custom" + "navigationStyle": "custom", + "navigationBarTitleText":"支付结果" } }, { @@ -35,19 +36,22 @@ { "path": "pages/user/my/myregister", "style": { - "navigationStyle": "custom" + "navigationStyle": "custom", + "navigationBarTitleText":"我的报名" } }, { "path": "pages/shop/goodsdetail", "style": { - "navigationStyle": "custom" + "navigationStyle": "custom", + "navigationBarTitleText":"商品详情" } }, { "path": "pages/coupon/index/index", "style": { - "navigationStyle": "custom" + "navigationStyle": "custom", + "navigationBarTitleText":"优惠券" } }, { @@ -74,7 +78,7 @@ { "path": "pages/article/details", "style": { - "navigationBarTitleText": "", + "navigationBarTitleText": "文章详情", "navigationStyle":"custom" } }, @@ -95,63 +99,63 @@ { "path": "pages/user/my/collect", "style": { - "navigationBarTitleText": "", + "navigationBarTitleText": "收藏", "navigationStyle": "custom" } }, { "path": "pages/user/my/vipinfo", "style": { - "navigationBarTitleText": "", + "navigationBarTitleText": "会员资料", "navigationStyle": "custom" } }, { "path": "pages/user/my/editname", "style": { - "navigationBarTitleText": "", + "navigationBarTitleText": "修改昵称", "navigationStyle": "custom" } }, { "path": "pages/user/my/setting", "style": { - "navigationBarTitleText": "", + "navigationBarTitleText": "设置", "navigationStyle": "custom" } }, { "path": "pages/user/my/center", "style": { - "navigationBarTitleText": "", + "navigationBarTitleText": "个人中心", "navigationStyle": "custom" } }, { "path": "pages/discover/discover", "style": { - "navigationBarTitleText": "", + "navigationBarTitleText": "发现", "navigationStyle": "custom" } }, { "path": "pages/shop/shopdetail", "style": { - "navigationBarTitleText": "", + "navigationBarTitleText": "品牌详情", "navigationStyle": "custom" } }, { "path": "pages/user/my/my", "style": { - "navigationBarTitleText": "", + "navigationBarTitleText": "个人主页", "navigationStyle": "custom" } }, { "path": "pages/discover/discoverdetails", "style": { - "navigationBarTitleText": "", + "navigationBarTitleText": "发现详情", "navigationStyle": "custom" } }, @@ -212,7 +216,7 @@ "navigationBarTitleText": "评价" } }, - { + { "path": "pages/recharge/balance/balance", "style": { "navigationBarTitleText": "余额" , diff --git a/pages/shop/goodsdetail.vue b/pages/shop/goodsdetail.vue index 931c22d..4711b78 100644 --- a/pages/shop/goodsdetail.vue +++ b/pages/shop/goodsdetail.vue @@ -26,36 +26,35 @@ + - 8493 + {{ goods_detail.redeem_point }} 个兑换 - + {{ goods_detail.name }} - 门店自提 - 可自提/可邮寄 - 已有38人购买 + 可自提/可邮寄 - + + 优惠 - - {{item.tag}} - - - 化妆品教师节满1200减200 + + {{ item.title }} + @@ -63,15 +62,18 @@ - + + + + 服务 - + - 正品保障 + {{ tagItem }} @@ -81,38 +83,13 @@ - - - - - - - 运费 - - 1KM以内,包含1KM;重量在5KG以内按6元计费,每超出1KG加收2元 - - - - - - - - + + - 已选 - 已选500ml x1 + 选择 + 选中的商品规格TODO @@ -120,40 +97,44 @@ + + - + - + - 颐莲官方店 + {{ brand_detail.name }} - L2 + {{ brand_detail.floor }} - + 客服 - + --> - - + + - 猪大肠卖咯 5毛钱一斤咯 - ¥0.5 + {{ item.name }} + ¥{{ item.sell_price }} - + 查看更多 @@ -162,6 +143,7 @@ + 商品详情 @@ -170,19 +152,20 @@ + - + {{ is_collect ? '已收藏' : '收藏' }} - @@ -198,16 +181,18 @@ + + - ¥{{ goods.min_price }} - {{ goods.name }} + ¥{{ goods_detail.min_price }}-¥{{ goods_detail.max_price }} + {{ goods_detail.name }} @@ -215,27 +200,29 @@ - 重量 - - {{ item +'0克' }} + + {{ value.label }} + + {{ item.value }} + 数量 - + - + - + @@ -244,18 +231,7 @@ - - - - - 店铺运费说明 - - - - - 1KM以内,包含1KM;重量在5KG以内按6元计费,每超出1KG加收2元 - - + @@ -278,36 +254,33 @@ skeletonLoading: false, pictures: [], show_popup: false, // 是否显示选规格模态框 - show_freight: false, // 是否显示运费说明模态框 spec_current: null, // 规格下标 click_type: null, // 当前点击的是加入购物车[1]还是立即购买[2] - type: 'mail', // 页面显示类型,mail普通可邮寄商品,self自提商品,point积分商品,seckill秒杀商品 + type: 'mail', // 页面显示类型,mail普通可邮寄商品,point积分商品,seckill秒杀商品 time: new Date('2021/09/8 14:15:00').getTime() - new Date('2021/09/8 13:10:00').getTime(), goods_stock: { - specs: [], - stores: [] - } + specs: {}, + stores: {} + }, + seckill: {}, // 秒杀商品的信息 + brand_detail: {}, + token: '', + coupons: [], // 优惠 + goods_num: 1 } }, onLoad(options){ console.log("options", options) + this.token = this.$cookieStorage.get('user_token'); this.goods_id = options.id; - this.type = options.type || 'mail'; + // this.type = options.type || 'mail'; // TODO 改变思路,不是由外界控制 this.getNewdetail(); - this.getGoodsStock(); - }, - computed: { - isRight() { - return function(val) { - return this.$shared.isRight(val); - } - } + this.getGoodsStock(); // 获取商品库存、规格信息 }, methods: { // 切换商品收藏 switchCollect(){ - let userInfo = this.$cookieStorage.get('user_token') || {}; - if(!userInfo){ + if(!this.token){ this.$url('/pages/login/index'); return; } @@ -315,7 +288,6 @@ }, //收藏 addCollcet() { - console.log('当前的商品id',this.goods_detail.id) this.$http.post({ api: 'api/collect/create', data: { @@ -323,7 +295,7 @@ collect_id: this.goods_detail.id, }, header: { - Authorization: this.$cookieStorage.get('user_token') + Authorization: this.token } }).then(res => { this.$msg(res.data.data); @@ -332,30 +304,44 @@ console.log("====", err); }) }, - showFreight(){ - this.show_freight = true; - }, + // 加入购物车和立即购买 shoot(type){ - // TODO 判断type做不同的逻辑 this.click_type = type; - if(this.goods_stock.specs.length){ + if(this.$isRight(this.goods_stock.specs)){ this.show_popup = true; }else{ this.confirm(); } }, - activeSpec(index){ - if(this.spec_current == index){ - this.spec_current = null; + // 商品选规格 + activeSpec(key, index){ + let obj = this.goods_stock.specs; + if(obj[key].spec_current == index){ + obj[key].spec_current = null; }else{ - this.spec_current = index; + obj[key].spec_current = index; + } + this.$set(this.goods_stock, 'specs', obj); + }, + // 商品加减 + changeNum(type){ + if(type == 'add'){ + if(this.goods_num < 10){ + this.goods_num++; + } + }else if(type == 'less'){ + if(this.goods_num > 1){ + this.goods_num--; + } } }, + // 跳转至下单页TODO confirm(){ if(this.click_type == 2){ this.$url('/pages/order/confirm/confirm'); } }, + // 点击页面分享按钮 shareGraphic(){ this.getCreateShareImg(); }, @@ -398,27 +384,58 @@ }) }, + // 商品详情 getNewdetail(){ this.$http.get({ api: 'api/store/detail/'+ this.goods_id, header: { - Authorization: this.$cookieStorage.get('user_token') + Authorization: this.token } }).then(res => { console.log("===---", res); - this.goods_detail = res.data.data; + let meta = res.data.meta; + let goods_detail = res.data.data; + this.goods_detail = goods_detail; this.pictures = [res.data.data.img]; this.is_collect = Boolean(res.data.data.is_collect) || false; - console.log("this.pictures", this.pictures); + let type = 'mail'; + if(this.$isRight(goods_detail.is_largess)){ + type = 'point'; + } + if(this.$isRight(meta.seckill)){ + type = 'seckill'; + this.seckill = meta.seckill; + } + if(type != 'point'){ + this.getBrandDetail(goods_detail.brand_id); + } + if(this.$isRight(meta.discounts)){ + this.coupons = meta.discounts.coupons; + } + this.type = type; }).catch(err => { console.log("====", err); }) }, + // 获取商家信息 + getBrandDetail(brand_id){ + this.$http.get({ + api: 'api/brand/detail', + data: { + brand_id: brand_id + }, + header: { + Authorization: this.token + } + }).then(res => { + this.brand_detail = res.data.data; + }) + }, + // 获取商品库存信息 getGoodsStock(){ this.$http.get({ api: `api/store/detail/${this.goods_id}/stock` }).then(res => { - console.log("getGoodsStock", res); this.goods_stock = res.data.data; }) }, @@ -428,7 +445,7 @@ phoneNumber: String(phoneStr) }) }, - // 打开地图 + // 打开地图 PS.暂时用不到 openMap(){ let { address, lat, lng } = this.goods_detail?.store || {}; uni.openLocation({ @@ -438,16 +455,9 @@ name: address }); }, - // 跳转到确认下单页面 - toAddOrder(){ - let goods_id = this.goods_detail.id; - this.$url('/pages/order/confirm_order?goods_id='+ goods_id); - }, // 预览图片 lookImg(index){ this.$u.throttle(() => { - // let goods_banner = this.goods_detail.banners || []; - // let banners = goods_banner.map(item => item.cover); let banners = this.pictures; uni.previewImage({ urls: banners, @@ -479,8 +489,8 @@ onShareAppMessage(){ let goods = this.goods_detail; let title = goods.name; - let imageUrl = goods.share_cover || goods.cover; - let path = '/pages/route/index?route=goods_detail&id='+ goods.id; + let imageUrl = goods.share_cover || goods.cover || goods.img; + let path = '/pages/route/index?route=detail&id='+ goods.id; return { title,