From 4ef1a9b7700c8ad19bca5d8e29bab0ed59363f6b Mon Sep 17 00:00:00 2001 From: shuxiaoquan <853623962@qq.com> Date: Wed, 28 Feb 2024 13:33:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/goods/index.js | 2 +- api/newFun.js | 5 ++ components/goods-sku-popup/index.vue | 29 ++++---- pages/goods/components/SkuPopup.vue | 9 ++- pages/goods/detail.vue | 99 +++++++++++++++++----------- pages/news1/jinqun.vue | 29 ++++---- 6 files changed, 108 insertions(+), 65 deletions(-) diff --git a/api/goods/index.js b/api/goods/index.js index a2c7969..3d8f627 100644 --- a/api/goods/index.js +++ b/api/goods/index.js @@ -16,7 +16,7 @@ const api = { // 商品价格修改 export const editGoodsPrice = (param, option) => { - return request.get('StoreKeeper/editGoodsPrice', param, option) + return request.post('StoreKeeper/editGoodsPrice', param, option) } // 商品浏览记录 diff --git a/api/newFun.js b/api/newFun.js index 56f6253..9526792 100644 --- a/api/newFun.js +++ b/api/newFun.js @@ -1,5 +1,10 @@ import request from '@/utils/request' +// 获取分享图 +export const getStoreInfo = (param) => { + return request.post('store/getStoreInfo', param) +} + // 邀请有礼 邀请好友海报 export const InviteUserPoster = (param) => { return request.post('user/InviteUserPoster', param) diff --git a/components/goods-sku-popup/index.vue b/components/goods-sku-popup/index.vue index a7b18ef..0f10929 100644 --- a/components/goods-sku-popup/index.vue +++ b/components/goods-sku-popup/index.vue @@ -24,7 +24,6 @@ - {{ item.name }} @@ -39,7 +38,7 @@ - + 数量 - {{ buyNowText }} + {{ userInfo.user_type == 40?'修改价格':buyNowText }} @@ -84,7 +83,7 @@ color: themeColorFn('buyNowColor'), backgroundColor: themeColorFn('buyNowBackgroundColor') }" @click="buyNow"> - {{ buyNowText }} + {{ userInfo.user_type == 40?'修改价格':buyNowText }} @@ -328,7 +327,8 @@ }, }, data() { - return { + return { + userInfo: {}, complete: false, // 组件是否加载完成 goodsInfo: {}, // 商品信息 isShow: false, // true 显示 false 隐藏 @@ -431,7 +431,8 @@ vk = that.vk; if (that.valueCom) { that.open(); - } + } + this.userInfo = uni.getStorageSync('userInfo') }, mounted() {}, methods: { @@ -450,7 +451,8 @@ that.selectArr.push(''); that.subIndex.push(-1); }); - + console.log(notAutoClick,that.specListName) + console.log(that.goodsInfo) that.checkItem(); // 计算sku里面规格形成路径 that.checkInpath(-1); // 传-1是为了不跳过循环 if (!notAutoClick) that.autoClickSku(); // 自动选择sku策略 @@ -779,9 +781,6 @@ selectShop.buy_num = that.selectNum; that.$emit('add-cart', selectShop); that.$emit('cart', selectShop); - // setTimeout(function() { - // that.init(); - // }, 300); } }); }, @@ -789,11 +788,11 @@ buyNow() { let that = this; that.checkSelectComplete({ - success: function(selectShop) { - selectShop.buy_num = that.selectNum; - console.log(selectShop) - that.$emit('buy-now', selectShop); - that.$emit('buy', selectShop); + success: function(selectShop) { + selectShop.buy_num = that.selectNum; + console.log(selectShop) + that.$emit('buy-now', selectShop); + that.$emit('buy', selectShop); } }); }, diff --git a/pages/goods/components/SkuPopup.vue b/pages/goods/components/SkuPopup.vue index f7e263d..3c6e2b5 100644 --- a/pages/goods/components/SkuPopup.vue +++ b/pages/goods/components/SkuPopup.vue @@ -174,7 +174,14 @@ // 立即购买 buyNow(selectShop) { - console.log("buyNow",selectShop) + console.log("buyNow",selectShop) + if(uni.getStorageSync("userInfo").user_type == 40){ + // 隐藏当前弹窗 + this.onChangeValue(false); + uni.$emit("onenPrice",selectShop) + return ; + console.log(selectShop) + } // 跳转到订单结算页 this.$navTo('pages/sureOrder/index', { mode: 'buyNow', diff --git a/pages/goods/detail.vue b/pages/goods/detail.vue index e974230..09062ed 100644 --- a/pages/goods/detail.vue +++ b/pages/goods/detail.vue @@ -84,20 +84,20 @@ - - - + 送至 @@ -207,7 +207,10 @@ @@ -293,7 +296,7 @@ 原价格: - + 商品价格: @@ -327,7 +330,7 @@ --> - + 取消 @@ -417,7 +420,7 @@ - + 取消 @@ -425,8 +428,9 @@ - - + + + @@ -444,6 +448,8 @@ }, data() { return { + isTodo: true, + result: {}, max_price: "", markup_rate: "", showGoodsPosterPopup: false, @@ -476,12 +482,13 @@ addressInfo: {}, serveList:[], isLogin: false, - + selectShop: {}, // 获取商品海报图api方法 posterApiCall: GoodsApi.poster, } }, - onLoad(options) { + onLoad(options) { + const that = this; console.log(options,"oo") this.isPre = options.isPre?options.isPre:null this.goodsId = options.goodsId?options.goodsId:null @@ -493,7 +500,13 @@ this.getSuggestGoods() this.getServeList() this.getGoodsDetail() - this.cityInfo = uni.getStorageSync("cityInfo"); + this.cityInfo = uni.getStorageSync("cityInfo"); + uni.$on("onenPrice",function(selectShop) { + that.openPirce(); + that.isTodo = false; + that.selectShop = selectShop + that.selectShop.price = that.selectShop.price/100 + }) }, onShow() { if(uni.getStorageSync('AccessToken')){ @@ -530,19 +543,22 @@ }) return ; } + let sku_id = "" + if(that.goods.spec_type == 20){ + sku_id = that.goods.skuList[0].id + } let params={ id: that.goods.goods_id, goods_price: that.max_price, line_price: that.markup_rate, - cat_id: that.goods.category.category_id + sku_id: sku_id.toString() } GoodsApi.editGoodsPrice(params).then(res => { if (res.status == 200) { - that.shareCancel(); that.$toast("修改成功"); setTimeout(()=>{ - that.getGoodsDetail(); - },1000) + that.getGoodsDetail(1); + },500) } }) .catch() @@ -560,9 +576,13 @@ }) }, //修改价格 - openPirce() { + openPirce(type) { this.openDialog = true; this.shareType= 'setPrice' + if(type == 1){ + this.selectShop = {} + this.selectShop.price = this.goods.goods_price_max; + } }, //门店图片预览 previewImage(i){ @@ -697,6 +717,7 @@ console.log(total) }, choseSku(skuMode) { + console.log(this.goods) if(!uni.getStorageSync("AccessToken")) { uni.navigateTo({ url: "/pages/login/index" @@ -723,22 +744,20 @@ }); }, // 获取商品信息 - getGoodsDetail() { + getGoodsDetail(type) { const that = this return new Promise((resolve, reject) => { GoodsApi.detail(this.goodsId) .then(result => { let info = result.data.detail; + that.goods.skuList = []; + that.godds = {} info.goods_images1 = [] if(info.goods_images && info.goods_images.length > 0){ info.goods_images.map(a=>{ info.goods_images1.push(a.preview_url) }) - } - // if(info.skuList && info.skuList.length > 0){ - // info.skuList = info.skuList.reverse(); - // } - + } info.content = info.content .replace(/style=""/g,'') .replace(/