diff --git a/api/packageIntegral/productList.js b/api/packageIntegral/productList.js index 746fa8a..84df717 100644 --- a/api/packageIntegral/productList.js +++ b/api/packageIntegral/productList.js @@ -46,4 +46,24 @@ export default{ method: 'get', }) }, + getEdit(id) { // 根据id查询商品数据接口 + return request({ + url: `/oil-mall/mallProductInfo/getEdit/${id}`, + method: 'get' + }) + }, + saveProduct(data) { // 新增商品接口 + return request({ + url: `/oil-mall/mobile/saveProduct`, + method: 'post', + data + }) + }, + updateProduct(data) { // 编辑更新商品数据接口 + return request({ + url: `/oil-mall/mobile/updateProduct`, + method: 'post', + data + }) + }, } \ No newline at end of file diff --git a/packageIntegral/productAddition/index.vue b/packageIntegral/productAddition/index.vue index 61b3b60..cd0fa06 100644 --- a/packageIntegral/productAddition/index.vue +++ b/packageIntegral/productAddition/index.vue @@ -58,7 +58,6 @@ - 批量填充:批量填充填入信息后,可以批量将内容填写到SKU 信息里 - {{item.label}} - 确定 + {{item.label}} + 确定 @@ -94,7 +93,9 @@ 规格: {{radioAttributes}}+{{items}} - {{item.label}} + + + 删除 @@ -103,29 +104,38 @@ 规格: {{radioAttributes}} - {{item.label}} + + + 删除 * 商品图片:最多可上传10张图片 - - 商品主图 - 设为主图 - - - - - + + + + 商品主图 + + + + + 设为主图 + + + + + + - + 上一步 @@ -143,17 +153,17 @@ import utils from '@/utils/encode' import serve from '@/api/packageIntegral/productList.js' import mulpicker from '@/packageIntegral/components/mulpicker.vue' - import productAddStep2 from '@/packageIntegral/productAddition/productAddStep2.vue' export default { components: { - mulpicker, - productAddStep2 + mulpicker }, data() { return { currentBoxId: 'instruction', //当前显示的view的id isBoxShow: false, - productDate:{}, + productDate:{ + images:[] + }, productList:[], brandIdList:[], radioItem:[{ @@ -172,13 +182,14 @@ attributesTypeList:[], attributesList:[], bottonList:[ - {label:'市场价格',value:'marketPrice'}, - {label:'销售价格',value:'sellPrice'}, - {label:'商品库存',value:'stock'}, - {label:'兑换积分',value:'integral'} + {label:'市场价格',value:'marketPrice',checked:false}, + {label:'销售价格',value:'sellPrice',checked:false}, + {label:'商品库存',value:'stock',checked:false}, + {label:'兑换积分',value:'integral',checked:false} ], radioAttributes:'', - checkboxAttributes:[] + checkboxAttributes:[], + stockList:[] } }, @@ -296,6 +307,30 @@ }, deleteRadio(){ this.radioAttributes = '' + }, + changeChecked(item){ + + item.checked = !item.checked + console.log(this.radioAttributes,this.checkboxAttributes) + + }, + addStockList(){ + this.stockList = [] + let obj = {} + this.bottonList.forEach(tab=>{ + if(tab.checked == true){ + if(tab.value == 'marketPrice'){ + obj.marketPrice = '' + }else if(tab.value == 'sellPrice'){ + obj.sellPrice = '' + }else if(tab.value == 'stock'){ + obj.stock = '' + }else if(tab.value == 'integral'){ + obj.integral = '' + } + } + }) + this.stockList.push(obj) }, // 调用系统相机 takePhoto() { @@ -319,13 +354,13 @@ success: (modalRes) => { if (modalRes.confirm) { // 引导用户去设置中打开权限 - wx.openSetting({ + uni.openSetting({ success(res) { if (res.authSetting['scope.camera']) { re() - // 授权成功,重新定位 + // 授权成功 } else { - // 没有允许定位权限 + // 没有允许相机权限 wx.showToast({ title: '您拒绝了相机权限,将无法使用相机功能', icon: 'none' @@ -356,6 +391,7 @@ //调起上传图片 srcFileImage() { let _that = this + let imageUrl = '' uni.chooseImage({ count: 10, //默认9 sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 @@ -386,8 +422,8 @@ console.log('进入2') console.log(e) let obj = JSON.parse(e.data), - url = obj.data.publicUrl - console.log(obj.data.publicUrl) + imageUrl = obj.data.publicUrl + _that.getImage(imageUrl) }, fail(err) { console.log(err) @@ -398,6 +434,27 @@ } }) }, + getImage(imageUrl){ + if(JSON.stringify(this.productDate.images) == '[]'){ + this.productDate.images.push({ + url:imageUrl, + mainMark:1 + }) + }else{ + this.productDate.images.push({ + url:imageUrl, + mainMark:'' + }) + } + }, + clearImage(index){ + if(this.productDate.images[index].mainMark == 1){ + this.productDate.images.splice(index,1) + this.productDate.images[0].mainMark = 1 + }else{ + this.productDate.images.splice(index,1) + } + }, picker2(e){ console.log(e.detail.value) this.productDate.value = e.detail.value @@ -500,6 +557,10 @@ text-align: center; margin: 8rpx; } + .checkedTag{ + background-color: #2979ff; + color: #FFFFFF; + } .redButton{ display: inline-block; width: 84rpx; @@ -510,16 +571,41 @@ line-height: 58rpx; text-align: center; } + .commodityImage{ + display: inline-block; + max-width: calc(100%-150rpx); + } + .imageList{ + display: inline-block; + width: 140rpx; + margin: 0 10rpx; + } .imageBlack{ display: inline-block; width: 140rpx; height: 140rpx; - line-height: 140rpx; - // position: relative; - .cameraImage{ - // position: absolute; - // left: 70rpx; - // top: 70rpx; + position: relative; + >image{ + width: 100%; + height: 100%; + } + .cameraText{ + width: 140rpx; + height: 30rpx; + text-align: center; + line-height: 30rpx; + position: absolute; + background-color: #333; + opacity: 0.3; + color: #FFFFFF; + left: 0rpx; + top: 110rpx; + } + .cameraClear{ + position: absolute; + left: 120rpx; + top: -10rpx; + z-index: 20; } } diff --git a/packageIntegral/productAddition/productAddStep2.vue b/packageIntegral/productAddition/productAddStep2.vue deleted file mode 100644 index bd45224..0000000 --- a/packageIntegral/productAddition/productAddStep2.vue +++ /dev/null @@ -1,137 +0,0 @@ - - - - - \ No newline at end of file diff --git a/packageIntegral/productList/index.vue b/packageIntegral/productList/index.vue index b02a0a1..8ee4a14 100644 --- a/packageIntegral/productList/index.vue +++ b/packageIntegral/productList/index.vue @@ -32,7 +32,7 @@ :style="{background:statusEnum[item.auditStatus].color}" >{{statusEnum[item.auditStatus].value}} 删除 - 编辑 + 编辑 {{item.productStatus =='1'?'上架':'下架'}} @@ -194,7 +194,7 @@ }, toDetails(item) { uni.navigateTo({ - url: `../orderDetails/index?orderId=${item.orderId}` + url: `../orderDetails/index?orderId=${item.id}` }) }, getTopInfo(){ @@ -242,6 +242,13 @@ orderDelete(){ this.$refs.delete.open('center') }, + editOrder(item){ + console.log(item) + uni.navigateTo({ + url: `../productUpdate/index??orderId=${item.id}` + }) + + }, upDownFrame(item) { this.productData = item this.$refs.popup.open('center') diff --git a/packageIntegral/productUpdate/index.vue b/packageIntegral/productUpdate/index.vue new file mode 100644 index 0000000..cd0fa06 --- /dev/null +++ b/packageIntegral/productUpdate/index.vue @@ -0,0 +1,684 @@ + + + + +