diff --git a/pages/goods/addGoods.vue b/pages/goods/addGoods.vue index 84ff60f..3c63382 100644 --- a/pages/goods/addGoods.vue +++ b/pages/goods/addGoods.vue @@ -1,39 +1,155 @@ @@ -41,29 +157,802 @@ export default { data() { return { + dataList: {}, + modalType:0, + maxSelect:1, + currentCanbuy:1, + canbuyMap:{}, + categoryData:[], + categoryIndex: 0, + modalclassType:'', + categorySonData:[], + specValueArr:[], + attrValueArr:[], + editorIns: null, + typeItem: {}, formData: { - productName: '', - productPicture: '', - categoryId: '', - productPictures: [] + id: '', + shopId: '', + attrId:'', + categoryId: '', //商品分类id + categoryName: '', //商品分类名称 + productPicture: '', //商品图标 + productName: '', //商品名称 + orderFiled: '', //商品名称 + lunchBox: 0, //餐盒 + startPayNum: '', //起售数量 + attributeListPrice: [{ //商品规格 + specPrice: "", + specNum: 9999 + }], + shopId:'', + sellTime: 0, //可售时间 + isMoreBuy: 0, + sellBeginTime: '', //可售时段自定义---开始时间 + sellEndTime: '', //可售时段自定义---结束时间 + attributeList: '', + productGroupBuyPrices: [], + attributeList1: new Map(), //商品属性 + productIntro: "" //详细图文 + }, + rules: { + productName: { + rules: [{ + required: true, + errorMessage: '请输入名称', + }] + }, + categoryId: { + rules: [{ + required: true, + errorMessage: '请选择商品分类', + }, ], + }, }, } + }, + filters: { + }, onShow() { + this.attrId = uni.getStorageSync('attrId'); + uni.authorize({ + scope: 'scope.writePhotosAlbum', + success() { + }, + fail() { + uni.showToast({ + title: "您未授权,图片上传功能可能会出现错误", + icon: 'none' + }) + } + }) + this.typeItem = JSON.parse(JSON.stringify(this.typeItem)) || '' + if (this.typeItem) { + this.formData.categoryId = this.typeItem.id + } + this.formData.shopId = uni.getStorageSync('shopId') }, onLoad(option) { - + this.getGategoryList() + if (option.dataList != undefined && option.dataList != null && option.dataList != 'undefined') { + this.dataList = JSON.parse(option.dataList) + + this.NB.sendRequest("/app/product/getById/" + this.dataList.id, {}, false, 'POST', 'application/x-www-form-urlencoded').then((res) => { + if (res.code == 200) { + this.modalType = 1 + this.formData.id = res.result.id + this.formData.shopId = res.result.shopId + this.formData.categoryName = res.result.categoryName + this.formData.orderFiled = res.result.orderFiled + this.formData.lunchBox = res.result.lunchBox + this.formData.startPayNum = res.result.startPayNum + this.formData.attributeListPrice = JSON.parse(res.result.attributeListPrice) + this.formData.shopId = res.result.shopId + this.formData.sellTime = res.result.sellBeginTime !=''?1:0 + this.formData.isMoreBuy = res.result.isMoreBuy + this.formData.sellBeginTime = res.result.sellBeginTime + this.formData.sellEndTime = res.result.sellEndTime + this.formData.attributeList = res.result.attributeList + this.formData.productGroupBuyPrices = res.result.productGroupBuyPrices + this.formData.attributeList1 = new Map() + this.formData.productName = res.result.productName + this.formData.productPicture = res.result.productPicture + this.formData.productIntro = res.result.productIntro + this.formData.categoryId = res.result.categoryId + this.edit(this.formData) + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) + } + uni.hideLoading() + }).catch((res) => {}) + } }, methods: { - + /** + * 获取输入内容 + * @param {Object} e {html,text} 内容的html文本,和text文本 + */ + inputOver(e) { + // 可以在此处获取到编辑器已编辑的内容 + console.log('==== inputOver :', e) + this.productIntro = e + }, + /** + * 超出最大内容限制 + * @param {Object} e {html,text} 内容的html文本,和text文本 + */ + overMax(e) { + // 若设置了最大字数限制,可在此处触发超出限制的回调 + console.log('==== overMax :', e) + }, + /** + * 编辑器就绪 + * @param {Object} editor 编辑器实例,你可以自定义调用editor实例的方法 + * @tutorial editor组件 https://uniapp.dcloud.net.cn/component/editor.html#editor-%E7%BB%84%E4%BB%B6 + * @tutorial 相关api https://uniapp.dcloud.net.cn/api/media/editor-context.html + */ + initEditor(editor) { + this.editorIns = editor // 保存编辑器实例 + // 保存编辑器实例后,可以在此处获取后端数据,并赋值给编辑器初始化内容 + + }, + /** + * 直接运行示例工程插入图片无法正常显示的看这里 + * 因为插件默认采用云端存储图片的方式 + * 以$emit('upinImage', tempFiles, this.editorCtx)的方式回调 + * @param {Object} tempFiles + * @param {Object} editorCtx + */ + upinImage(tempFiles, editorCtx) { + /** + * 本地临时插入图片预览 + * 注意:这里仅是示例本地图片预览,因为需要将图片先上传到云端,再将图片插入到编辑器中 + * 正式开发时,还请将此处注释,并解开下面 使用 uniCloud.uploadFile 上传图片的示例方法 的注释 + * @tutorial https://uniapp.dcloud.net.cn/api/media/editor-context.html#editorcontext-insertimage + */ + // #ifdef MP-WEIXIN + // 注意微信小程序的图片路径是在tempFilePath字段中 + editorCtx.insertImage({ + src: tempFiles[0].tempFilePath, + width: '80%', // 默认不建议铺满宽度100%,预留一点空隙以便用户编辑 + success: function() {} + }) + // #endif + + // #ifndef MP-WEIXIN + editorCtx.insertImage({ + src: tempFiles[0].path, + width: '80%', // 默认不建议铺满宽度100%,预留一点空隙以便用户编辑 + success: function() {} + }) + // #endif + + /** + * 使用 uniCloud.uploadFile 上传图片的示例方法(可适用多选上传) + * 正式开发环境中,请将上面 本地临时插入图片预览 注释后,模仿以下写法 + */ + // tempFiles.forEach(async (item) => { + // uni.showLoading({ + // title: '上传中请稍后', + // mask: true + // }) + // let upfile = await uniCloud.uploadFile({ + // filePath: item.path, + // // 同名会导致报错 policy_does_not_allow_file_overwrite + // // cloudPath可由 想要存储的文件夹/文件名 拼接,若不拼文件夹名则默认存储在cloudstorage文件夹中 + // cloudPath: `cloudstorage/${item.name}`, + // cloudPathAsRealPath: true + // }) + // editorCtx.insertImage({ + // src: upfile.fileID, + // width: '80%', // 默认不建议铺满宽度100%,预留一点空隙以便用户编辑 + // success: function () { + // uni.hideLoading() + // } + // }) + // }) + }, + //跳转分类页 + goGategoryLow() { + uni.navigateTo({ + url: '/package1/myCenter/addType' + }) + }, + //初始化获取分类列表 + getGategoryList() { + this.NB.sendRequest("/app/productCategory/list", { + shopId:uni.getStorageSync('shopId') + }, false, 'get', 'application/x-www-form-urlencoded').then((res) => { + if (res.code == 200) { + if (res.result.length > 0) { + if(this.formData.categoryId != '' && this.formData.categoryId != undefined){ + for(let i=0;i {}) + }, + // 触发提交表单 + submit() { + let that = this; + // this.$refs.form.validate((valid) => { + // if (valid) { + if (this.modalType == 0) { + // 添加 避免编辑后传入id等数据 记得删除 + delete this.formData.id; + if(this.formData.isMoreBuy != 1){ + this.formData.isMoreBuy = 0 + } + this.formData.attributeListPrice = JSON.stringify(this.formData.attributeListPrice) + this.formData.attributeList = Object.fromEntries(this.formData.attributeList1) + this.formData.attributeList = JSON.stringify(this.formData.attributeList) + + this.NB.sendRequest("/app/product/save",this.formData, false, 'post', 'application/json').then((res) => { + if (res.code == 200) { + uni.showToast({ + title: "操作成功", + icon: 'none' + }) + uni.navigateBack() + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) + } + uni.hideLoading() + }).catch((res) => {}) + } else if (this.modalType == 1) { + // 编辑 + this.formData.attributeListPrice = JSON.stringify(this.formData.attributeListPrice) + this.formData.attributeList = Object.fromEntries(this.formData.attributeList1) + this.formData.attributeList = JSON.stringify(this.formData.attributeList) + this.formData.productPictures = [] + + this.NB.sendRequest("/app/product/edit",this.formData, false, 'post', 'application/json').then((res) => { + if (res.code == 200) { + uni.showToast({ + title: "操作成功", + icon: 'none' + }) + uni.navigateBack() + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) + } + uni.hideLoading() + }).catch((res) => {}) + } + // } + // }); + }, + back() { + uni.navigateBack() + }, + checkisMoreBuy(type){ + this.formData.isMoreBuy = type; + }, + checkSellTime(type){ + this.formData.sellTime = type; + }, + selectDateRange(e,type){ + if(type == 'start'){ + this.formData.sellBeginTime = e.detail.value + }else{ + this.formData.sellEndTime = e.detail.value + } + }, + guigeSubmit(){ + if(this.modalclassType == 'shuxing'){ + // 保存当前分类的canbuy值 + if(this.typeToAttrName){ + this.canbuyMap[this.typeToAttrName] = parseInt(this.currentCanbuy) || 1 + } + for(let i=0;i { + value.canbuy = value.canbuy || 1 + this.canbuyMap[key] = value.canbuy + for(let i = 0;i { + if (res.code == 200) { + that.categoryData = res.result + for (var i = 0; i < that.categoryData.length; i++) { + that.categoryData[i].title = that.categoryData[i].attributeName + if (i == that.categoryIndex) { + that.categoryData[i].parentId = true + } else { + that.categoryData[i].parentId = false + } + } + //如果是选择属性,需要拿一个分类名,保存成parent + that.typeToAttrName = res.result[that.categoryIndex].title + // 恢复该分类之前设置的canbuy值 + that.currentCanbuy = that.canbuyMap[that.typeToAttrName] || 1 + that.getCateGorySon(res.result[that.categoryIndex].id) + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) + } + uni.hideLoading() + }).catch((res) => {}) + }, + getCateGorySon(id){ + let that = this + + this.NB.sendRequest("/app/productAttributeValue/selectByAttributeId",{ + id: id, + }, false, 'get', 'application/x-www-form-urlencoded').then((res) => { + if (res.code == 200) { + that.categorySonData = res.result + for (var i = 0; i < that.categorySonData.length; i++) { + that.categorySonData[i].title = that.categorySonData[i].value + that.$set(that.categorySonData[i], 'checked', false) + } + if(that.modalclassType == 'shuxing'){ + for (var i = 0; i < that.categorySonData.length; i++) { + for (var m = 0; m < that.attrValueArr.length; m++) { + if(that.attrValueArr[m].title == that.categorySonData[i].title && that.attrValueArr[m].parentName == that.typeToAttrName){ + that.$set(that.categorySonData[i], 'checked', true) + } + } + } + }else{ + //guige + for (var i = 0; i < that.categorySonData.length; i++) { + for (var m = 0; m < that.specValueArr.length; m++) { + if(that.specValueArr[m].id == that.categorySonData[i].id){ + that.$set(that.categorySonData[i], 'checked', true) + } + } + } + } + console.log() + that.$forceUpdate(that.categorySonData) + that.$forceUpdate(that.categoryData) + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) + } + uni.hideLoading() + }).catch((res) => {}) + }, + deldantiaoguige(index){ + for (var m = 0; m < this.specValueArr.length; m++) { + if(this.specValueArr[m].id == this.formData.attributeListPrice[index].id){ + this.specValueArr.splice(m,1) + this.formData.attributeListPrice.splice(index,1) + console.log("11",this.formData.attributeListPrice) + if(this.formData.attributeListPrice.length == 1){ + this.formData.attributeListPrice = [] + this.formData.attributeListPrice.push({ + specName:"", + specPrice:'', + specNum:9999 + }) + this.specValueArr = [] + } + this.$forceUpdate() + return + } + } + }, + delGroup(index){ + this.formData.productGroupBuyPrices.splice(index,1) + }, + changePrice(index){ + this.specValueArr[index].specPrice = this.formData.attributeListPrice[index].specPrice + }, + changeCount(index){ + this.specValueArr[index].specNum = this.formData.attributeListPrice[index].specNum + }, + addGroup(){ + let data = { + groupCount:'', + groupPrice:0 + } + this.formData.productGroupBuyPrices.push(data) + }, + async upLoadFile(path) { + let that = this; + let hiver_token = uni.getStorageSync("hiver_token") + await uni.uploadFile({ + url: that.tui.interfaceUrl() + '/upload/file', + filePath: path, + name: 'file', + header: { + "content-type": "multipart/form-data", + 'accessToken': hiver_token + }, + formData: {}, + success: (uploadFileRes) => { + let pathData = JSON.parse(uploadFileRes.data) + that.formData.productPicture = pathData.result + that.$forceUpdate() + }, + fail: (err) => { + uni.hideLoading(); + uni.showToast({ + title: JSON.stringify(err), + icon: 'none' + }) + } + }); + await setTimeout(res => { + uni.hideLoading(); + }, 1000) + } } } \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue index c8433cc..1f7cc4f 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -316,6 +316,7 @@ //多店铺的时候点击选择需要登录的店铺 checkShop(item) { let that = this; + console.log('item、有没有attrid1',item) uni.getSystemInfo({ success: function (res1) { that.NB.sendRequest('/auth/chooseShop', { @@ -336,6 +337,7 @@ uni.setStorageSync('schoolShop',res.result.shop) uni.setStorageSync('schoolShop',res.result.shop) uni.setStorageSync('shopTakeaway',item.shopTakeaway) + uni.setStorageSync('attrId',item.shop.attrId) uni.setStorageSync('area',JSON.stringify(item)) uni.setStorageSync("isShop",true) setTimeout(() => { diff --git a/pages/shop/addGoods.vue b/pages/shop/addGoods.vue index ae56a7f..738e172 100644 --- a/pages/shop/addGoods.vue +++ b/pages/shop/addGoods.vue @@ -28,7 +28,6 @@ - @@ -57,9 +56,9 @@ - - - + + + 删除 新增拼团 @@ -68,8 +67,8 @@ - - {{value[0]}}: + + {{value[0]}}(可选{{value[1].canbuy || 1}}个): {{item}}、 @@ -126,16 +125,24 @@ - - + + {{item.title}} - - {{item.title}} + + + {{item.title}} + + + + 该分类可选数量 + + + @@ -153,6 +160,9 @@ return { dataList: {}, modalType:0, + maxSelect:1, + currentCanbuy:1, + canbuyMap:{}, categoryData:[], categoryIndex: 0, modalclassType:'', @@ -164,6 +174,7 @@ formData: { id: '', shopId: '', + attrId:'', categoryId: '', //商品分类id categoryName: '', //商品分类名称 productPicture: '', //商品图标 @@ -205,15 +216,7 @@ }, onShow() { - // uni.authorize({ - // scope: 'scope.writePhotosAlbum', - // success() { - - // }, - // fail() { - // this.tui.toast("您未授权,图片上传功能可能会出现错误") - // } - // }) + this.attrId = uni.getStorageSync('attrId'); this.typeItem = JSON.parse(JSON.stringify(this.typeItem)) || '' if (this.typeItem) { this.formData.categoryId = this.typeItem.id @@ -222,9 +225,10 @@ }, onLoad(option) { this.getGategoryList() - if (option.dataList) { + if (option.dataList != undefined && option.dataList != null && option.dataList != 'undefined') { this.dataList = JSON.parse(option.dataList) - this.NB.sendRequest("/app/product/getById/"+ this.dataList.id, {}, false, 'POST', 'application/json').then((res) => { + + this.NB.sendRequest("/app/product/getById/" + this.dataList.id, {}, false, 'POST', 'application/x-www-form-urlencoded').then((res) => { if (res.code == 200) { this.modalType = 1 this.formData.id = res.result.id @@ -248,8 +252,12 @@ this.formData.categoryId = res.result.categoryId this.edit(this.formData) } else { - this.tui.toast(res.message) + uni.showToast({ + title: res.message, + icon: 'none' + }) } + uni.hideLoading() }).catch((res) => {}) } }, @@ -341,15 +349,14 @@ //跳转分类页 goGategoryLow() { uni.navigateTo({ - url: '/pages/shop/addType' + url: '/package1/myCenter/addType' }) }, //初始化获取分类列表 getGategoryList() { - this.NB.sendRequest("/app/productCategory/list", { shopId:uni.getStorageSync('shopId') - }, false, 'get', 'application/json').then((res) => { + }, false, 'get', 'application/x-www-form-urlencoded').then((res) => { if (res.code == 200) { if (res.result.length > 0) { if(this.formData.categoryId != '' && this.formData.categoryId != undefined){ @@ -365,8 +372,12 @@ } } else { - this.tui.toast(res.message) + uni.showToast({ + title: res.message, + icon: 'none' + }) } + uni.hideLoading() }).catch((res) => {}) }, // 触发提交表单 @@ -384,12 +395,21 @@ this.formData.attributeList = Object.fromEntries(this.formData.attributeList1) this.formData.attributeList = JSON.stringify(this.formData.attributeList) - this.NB.sendRequest("/app/product/save", this.formData, false, 'post', 'application/json').then((res) => { - if(res.code == 200){ - that.tui.toast("操作成功"); + this.NB.sendRequest("/app/product/save",this.formData, false, 'post', 'application/json').then((res) => { + if (res.code == 200) { + uni.showToast({ + title: "操作成功", + icon: 'none' + }) uni.navigateBack() + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) } - }).catch(() => {}); + uni.hideLoading() + }).catch((res) => {}) } else if (this.modalType == 1) { // 编辑 this.formData.attributeListPrice = JSON.stringify(this.formData.attributeListPrice) @@ -397,12 +417,21 @@ this.formData.attributeList = JSON.stringify(this.formData.attributeList) this.formData.productPictures = [] - this.NB.sendRequest("/app/product/edit", this.formData, false, 'post', 'application/json').then((res) => { - if(res.code == 200){ - that.tui.toast("操作成功"); + this.NB.sendRequest("/app/product/edit",this.formData, false, 'post', 'application/json').then((res) => { + if (res.code == 200) { + uni.showToast({ + title: "操作成功", + icon: 'none' + }) uni.navigateBack() + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) } - }).catch(() => {}); + uni.hideLoading() + }).catch((res) => {}) } // } // }); @@ -425,23 +454,32 @@ }, guigeSubmit(){ if(this.modalclassType == 'shuxing'){ + // 保存当前分类的canbuy值 + if(this.typeToAttrName){ + this.canbuyMap[this.typeToAttrName] = parseInt(this.currentCanbuy) || 1 + } for(let i=0;i { + value.canbuy = value.canbuy || 1 + this.canbuyMap[key] = value.canbuy for(let i = 0;i { - if(res.code == 200){ - this.categoryData = res.result.content - for (var i = 0; i < this.categoryData.length; i++) { - if (i == this.categoryIndex) { - this.categoryData[i].parentId = true + this.NB.sendRequest("/app/productAttribute/selectByCategoryId",{categoryId:that.attrId}, false, 'post', 'application/x-www-form-urlencoded').then((res) => { + if (res.code == 200) { + that.categoryData = res.result + for (var i = 0; i < that.categoryData.length; i++) { + that.categoryData[i].title = that.categoryData[i].attributeName + if (i == that.categoryIndex) { + that.categoryData[i].parentId = true } else { - this.categoryData[i].parentId = false + that.categoryData[i].parentId = false } } //如果是选择属性,需要拿一个分类名,保存成parent - this.typeToAttrName = res.result.content[this.categoryIndex].title - this.getCateGorySon(res.result.content[this.categoryIndex].id) + that.typeToAttrName = res.result[that.categoryIndex].title + // 恢复该分类之前设置的canbuy值 + that.currentCanbuy = that.canbuyMap[that.typeToAttrName] || 1 + that.getCateGorySon(res.result[that.categoryIndex].id) + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) } - }).catch(() => {}); + uni.hideLoading() + }).catch((res) => {}) }, getCateGorySon(id){ + let that = this - this.NB.sendRequest("/dictData/getByCondition", { - name: "", - status: "", - pageNumber: 1, - pageSize: 100000, - sort: 'sortOrder', - order: 'asc', - dictId: id - }, false, 'GET', 'application/json').then((res) => { - if(res.code == 200){ - this.categorySonData = res.result.content - if(this.modalclassType == 'shuxing'){ - for (var i = 0; i < this.categorySonData.length; i++) { - if(this.attrValueArr.length>0){ - let index1 = false - for (var m = 0; m < this.attrValueArr.length; m++) { - if(this.attrValueArr[m].title == this.categorySonData[i].title){ - index1 = true - this.categorySonData[i].checked = true - } - } - if(index1){ - this.categorySonData[i].checked = true + this.NB.sendRequest("/app/productAttributeValue/selectByAttributeId",{ + id: id, + }, false, 'get', 'application/x-www-form-urlencoded').then((res) => { + if (res.code == 200) { + that.categorySonData = res.result + for (var i = 0; i < that.categorySonData.length; i++) { + that.categorySonData[i].title = that.categorySonData[i].value + that.$set(that.categorySonData[i], 'checked', false) + } + if(that.modalclassType == 'shuxing'){ + for (var i = 0; i < that.categorySonData.length; i++) { + for (var m = 0; m < that.attrValueArr.length; m++) { + if(that.attrValueArr[m].title == that.categorySonData[i].title && that.attrValueArr[m].parentName == that.typeToAttrName){ + that.$set(that.categorySonData[i], 'checked', true) } - }else{ - this.categorySonData[i].checked = false } } }else{ //guige - - - for (var i = 0; i < this.categorySonData.length; i++) { - if(this.specValueArr.length>0){ - for (var m = 0; m < this.specValueArr.length; m++) { - if(this.specValueArr[m].id == this.categorySonData[i].id){ - this.categorySonData[i].checked = true - } + for (var i = 0; i < that.categorySonData.length; i++) { + for (var m = 0; m < that.specValueArr.length; m++) { + if(that.specValueArr[m].id == that.categorySonData[i].id){ + that.$set(that.categorySonData[i], 'checked', true) } - }else{ - this.categorySonData[i].checked = false } } } - + console.log() + that.$forceUpdate(that.categorySonData) + that.$forceUpdate(that.categoryData) + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) } - }).catch(() => {}); + uni.hideLoading() + }).catch((res) => {}) }, deldantiaoguige(index){ for (var m = 0; m < this.specValueArr.length; m++) { @@ -710,7 +770,7 @@ let that = this; let hiver_token = uni.getStorageSync("hiver_token") await uni.uploadFile({ - url: getApp().globalData.mainurl + '/upload/file', + url: that.tui.interfaceUrl() + '/upload/file', filePath: path, name: 'file', header: { @@ -758,7 +818,7 @@ .title { background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/8bc15960c2dc40268e295d6dd23aecce.png') no-repeat; width: 100%; - height: 13%; + height: 54%; } .title-sreach { @@ -785,6 +845,10 @@ border-radius: 14rpx; box-shadow: 0 1px 20rpx 4rpx #e2e2e2; background-color: #fff; + position: fixed; + top: 200rpx; + left: 2.5%; + width: 90%; overflow: scroll; height: 85%; } diff --git a/pages/shop/goodsList.vue b/pages/shop/goodsList.vue index a8ab062..7d2c420 100644 --- a/pages/shop/goodsList.vue +++ b/pages/shop/goodsList.vue @@ -37,12 +37,16 @@ + + {{item.attributeListPrice | sliceMsg}} + 价格 + {{item.lunchBox}} 餐盒费 - {{item.startPayNum}} + {{item.startPayNum?item.startPayNum:0}} 起售数量 @@ -151,7 +155,16 @@ } }, filters: { - + sliceMsg(val) { + var name = '' + if (typeof(val) == 'string') { + let newObj = JSON.parse(val) + for (let as in newObj) { + name = newObj[as].specPrice + } + } + return name; + }, }, onShow() { this.getGategoryList() @@ -380,8 +393,6 @@ }, //初始化获取分类列表 getGategoryList() { - - this.NB.sendRequest("/app/productCategory/list", { shopId:this.shopId }, false, 'get', 'application/json').then((res) => {