From a0b52f8a4c81b2a675cd010826f691a3d6100e5b Mon Sep 17 00:00:00 2001 From: zhangyouji Date: Fri, 12 Apr 2024 17:09:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=95=86=E5=9F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packageElectron/components/autograph.vue | 8 + packageElectron/index.vue | 293 ++++ .../reconciliationDetails/index.vue | 8 + packageIntegral/productAddition/index.vue | 1222 ++++++++-------- packageIntegral/productList/index.vue | 89 +- packageIntegral/productUpdate/index.vue | 1249 +++++++++-------- pages.json | 15 + pages/home/home.vue | 6 + 8 files changed, 1710 insertions(+), 1180 deletions(-) create mode 100644 packageElectron/components/autograph.vue create mode 100644 packageElectron/index.vue create mode 100644 packageElectron/reconciliationDetails/index.vue diff --git a/packageElectron/components/autograph.vue b/packageElectron/components/autograph.vue new file mode 100644 index 0000000..02409e3 --- /dev/null +++ b/packageElectron/components/autograph.vue @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/packageElectron/index.vue b/packageElectron/index.vue new file mode 100644 index 0000000..ff853b0 --- /dev/null +++ b/packageElectron/index.vue @@ -0,0 +1,293 @@ + + + + + diff --git a/packageElectron/reconciliationDetails/index.vue b/packageElectron/reconciliationDetails/index.vue new file mode 100644 index 0000000..02409e3 --- /dev/null +++ b/packageElectron/reconciliationDetails/index.vue @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/packageIntegral/productAddition/index.vue b/packageIntegral/productAddition/index.vue index bab6ca5..54e42f7 100644 --- a/packageIntegral/productAddition/index.vue +++ b/packageIntegral/productAddition/index.vue @@ -4,95 +4,100 @@ 返回 新增商品 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 取消 - 下一步 + 下一步 - - - - - - - + + + + + + + 商品类型: - - {{item.attributeName}}: - - - - - - - + + {{item.attributeName}}: + + + + + + + - + 批量填充:批量填充填入信息后,可以批量将内容填写到SKU 信息里 - {{item.label}} - 确定 + + + + + + + + + + + + + + 确定 + * 规格: - {{radioAttributes}} - {{radioAttributes}}+{{checkboxAttributes[index]}} + {{radioAttributes}} + {{radioAttributes}}+{{checkboxAttributes[index]}} @@ -106,44 +111,45 @@ - 删除 + 删除 * 商品图片: 最多可上传10张图片 + + + + + 商品主图 + - - - - 商品主图 - - - - - 设为主图 - - + + + 设为主图 + - - - - + + + + - + + - - - 上一步 - 完成 + + + 上一步 + 完成 + - - + @@ -155,44 +161,64 @@ import serve from '@/api/packageIntegral/productList.js' import mulpicker from '@/packageIntegral/components/mulpicker.vue' export default { - components: { - mulpicker - }, + components: { + mulpicker + }, data() { return { currentBoxId: 'chooseType', //当前显示的view的id isBoxShow: false, - productDate:{ - productStatus:'1', - images:[] + productDate: { + productStatus: '1', + images: [] }, - productList:[], - brandIdList:[], - radioItem:[{ - name: '新品', - checked: true - }, { - name: '推荐', - checked: false - }], - rules:{ - demandRegion:{rules:[{required: true,errorMessage: '请选择商品分类'}]}, - productName:{rules:[{required: true,errorMessage: '请输入商品名称'}]}, - brandId:{rules:[{required: true,errorMessage: '请选择商品品牌'}]}, - price:{rules:[{required: true,errorMessage: '请输入商品售价'}]}, - }, - attributesTypeList:[], - attributesList:[], - bottonList:[ - {label:'市场价格',value:'marketPrice',checked:false}, - {label:'销售价格',value:'sellPrice',checked:false}, - {label:'商品库存',value:'stock',checked:false}, - {label:'兑换积分',value:'integral',checked:false} - ], - radioAttributes:'', - checkboxAttributes:[], - stockList:[], - checkedList:[] + productList: [], + brandIdList: [], + radioItem: [{ + name: '新品', + checked: true + }, { + name: '推荐', + checked: false + }], + rules: { + demandRegion: { + rules: [{ + required: true, + errorMessage: '请选择商品分类' + }] + }, + productName: { + rules: [{ + required: true, + errorMessage: '请输入商品名称' + }] + }, + brandId: { + rules: [{ + required: true, + errorMessage: '请选择商品品牌' + }] + }, + price: { + rules: [{ + required: true, + errorMessage: '请输入商品售价' + }] + }, + }, + attributesTypeList: [], + attributesList: [], + bottonList: [{ + marketPrice: '', + sellPrice: '', + stock: '', + integral: '' + }], + radioAttributes: '', + checkboxAttributes: [], + stockList: [], + checkedList: [] } }, @@ -201,515 +227,579 @@ this.getProductBrands() this.getAttributesType() }, - watch:{ - 'productDate.demandRegion'(val){ - if(val){ + watch: { + 'productDate.demandRegion'(val) { + if (val) { this.productDate.categoryOneId = val.split(',')[0] this.productDate.categoryTwoId = val.split(',')[1] } }, - 'productDate.attributesTypeId'(val){ - if(!val){ + 'productDate.attributesTypeId'(val) { + if (!val) { this.stockList = [] } } }, methods: { - switchChange(e){ - if(e.detail.value == true){ + switchChange(e) { + if (e.detail.value == true) { this.productDate.productStatus = '1' - }else if(e.detail.value == false){ + } else if (e.detail.value == false) { this.productDate.productStatus = '2' } }, - classfication(){ - serve.classification().then(res=>{ + classfication() { + serve.classification().then(res => { this.productList = res.data }) }, - getProductBrands(){ + getProductBrands() { this.brandIdList = [] - serve.getProductBrands().then(res=>{ - console.log(res) - res.data.forEach(tab=>{ - this.brandIdList.push({value:tab.id,text:tab.brandName}) + serve.getProductBrands().then(res => { + res.data.forEach(tab => { + this.brandIdList.push({ + value: tab.id, + text: tab.brandName + }) }) - + }) }, - checkbox (e) { - var index = e;//获取当前点击的下标 - var checkboxArr = this.radioItem;//选项集合 - // if (checkboxArr[index].checked) return;//如果点击的当前已选中则返回 - // checkboxArr.forEach(item => { - // item.checked = false - // }) - if(checkboxArr[index].checked ==false){ - checkboxArr[index].checked = true; //改变当前选中的checked值 - - }else { - checkboxArr[index].checked = false; //改变当前选中的checked值 - } - if(checkboxArr[0].checked ==true){ - this.productDate.newMark = 1 - }else{ - this.productDate.newMark = 2 - } - if(checkboxArr[1].checked ==true){ - this.productDate.recommend = 1 - }else{ - this.productDate.recommend = 2 - } - - }, - changeBox(e){ - let currentFlag = e.currentTarget.id; - if(currentFlag == 'next'){ - this.$refs.productForm.validate().then(res=>{ - console.log('表单数据信息:', res); - switch(currentFlag){ - case 'next': - this.currentBoxId = 'instruction' - break; - case 'previous': - this.currentBoxId = 'chooseType' - break; - default: - this.currentBoxId = 'viewInstruction' - break; + checkbox(e) { + var index = e; //获取当前点击的下标 + var checkboxArr = this.radioItem; //选项集合 + // if (checkboxArr[index].checked) return;//如果点击的当前已选中则返回 + // checkboxArr.forEach(item => { + // item.checked = false + // }) + if (checkboxArr[index].checked == false) { + checkboxArr[index].checked = true; //改变当前选中的checked值 + + } else { + checkboxArr[index].checked = false; //改变当前选中的checked值 + } + if (checkboxArr[0].checked == true) { + this.productDate.newMark = 1 + } else { + this.productDate.newMark = 2 + } + if (checkboxArr[1].checked == true) { + this.productDate.recommend = 1 + } else { + this.productDate.recommend = 2 + } + + }, + changeBox(e) { + let currentFlag = e.currentTarget.id; + if (currentFlag == 'next') { + this.$refs.productForm.validate().then(res => { + switch (currentFlag) { + case 'next': + this.currentBoxId = 'instruction' + break; + case 'previous': + this.currentBoxId = 'chooseType' + break; + default: + this.currentBoxId = 'viewInstruction' + break; } - if(currentFlag == 'next'){ + if (currentFlag == 'next') { this.getAttributesType() } - }).catch(err =>{ - console.log('表单错误信息:', err); - }) - }else{ - switch(currentFlag){ - case 'next': - this.currentBoxId = 'instruction' - break; - case 'previous': - this.currentBoxId = 'chooseType' - break; - default: - this.currentBoxId = 'viewInstruction' - break; + }).catch(err => {}) + } else { + switch (currentFlag) { + case 'next': + this.currentBoxId = 'instruction' + break; + case 'previous': + this.currentBoxId = 'chooseType' + break; + default: + this.currentBoxId = 'viewInstruction' + break; } } - - }, - getAttributesType(){ - this.attributesTypeList = [] - serve.getAttributesType().then(res=>{ - res.data.forEach(tab=>{ + + }, + getAttributesType() { + this.attributesTypeList = [] + serve.getAttributesType().then(res => { + res.data.forEach(tab => { this.attributesTypeList.push({ - value:tab.id, - text:tab.name, - number:tab.number, - attributesList:tab.attributesList + value: tab.id, + text: tab.name, + number: tab.number, + attributesList: tab.attributesList + }) + }) + }) + }, + attributesData() { + this.bottonList = [{ + marketPrice: '', + sellPrice: '', + stock: '', + integral: '' + }] + this.stockList = [] + this.radioAttributes = '' + this.checkboxAttributes = [] + if (this.productDate.attributesTypeId) { + this.attributesTypeList.forEach(tab => { + if (tab.value == this.productDate.attributesTypeId) { + this.attributesList = tab.attributesList + this.attributesList.forEach(tab => { + tab.attributesList = [] + tab.attributeContent.split(',').forEach(item => { + tab.attributesList.push({ + value: item, + text: item + }) + }) }) + + } + }) + } else { + this.attributesList = [] + } + + }, + changeRadio(item, index) { + if (JSON.stringify(this.checkedList) == '[]') { + this.checkedList.push({ + attributeId: item.id, + checked: this.radioAttributes + }) + } else { + this.checkedList[index].checked = this.radioAttributes + } + this.stockCheck() + }, + changeCheckBox(item, index) { + if (this.checkedList.length < index + 1) { + this.checkedList.push({ + attributeId: item.id, + checked: this.radioAttributes + }) + } else { + let checked = [] + this.checkboxAttributes.forEach(tab => { + checked.push(tab) }) - }) - }, - attributesData(){ - if(this.productDate.attributesTypeId){ - this.attributesTypeList.forEach(tab=>{ - if(tab.id = this.productDate.attributesTypeId){ - this.attributesList = tab.attributesList - this.attributesList.forEach(tab=>{ - tab.attributesList = [] - tab.attributeContent.split(',').forEach(item=>{ - tab.attributesList.push({value:item,text:item}) - }) - }) - - } - }) - }else{ - this.attributesList = [] - } - - }, - changeRadio(item,index){ - if(JSON.stringify(this.checkedList) == '[]'){ - this.checkedList.push({attributeId:item.id,checked:item.attributeName}) - }else{ - this.checkedList[index].checked = item.attributeName - } - }, - changeCheckBox(item,index){ - if(this.checkedList.length{ - checked.push(tab) - }) - this.checkedList[index].checked = checked.join(',') - this.checkedList.checked - } - }, - deleteCheckAll(i){ - if(this.checkboxAttributes.length>1){ - this.checkboxAttributes.splice(i,1) - }else{ - this.checkboxAttributes.splice(i,1) - this.radioAttributes = '' - } - this.stockList.splice(i,1) - }, - deleteRadio(){ - this.radioAttributes = '' - }, - changeChecked(item){ - item.checked = !item.checked - }, - addStockList(){ - this.stockList = [] - let obj = { - marketPrice:'', - sellPrice:'', - stock:'', - integral:'' - } - if(this.attributesList.length ==1){ - let data = {} - let name = this.attributesList[0].attributeName - let value = this.radioAttributes - data[name] = value - obj.attributeJson = JSON.stringify(data) - this.stockList.push(obj) - }else{ - this.checkboxAttributes.forEach((tab,index)=>{ - let name = this.attributesList[0].attributeName - let value = this.radioAttributes - let tabName = this.attributesList[index+1].attributeName - let tabValue = tab - data[name] = value - data[tabName] = tabValue - obj.attributeJson = JSON.stringify(data) - this.stockList.push(obj) - }) - - } - }, - //调起上传图片 - srcFileImage() { - let _that = this + this.checkedList[index].checked = checked.join(',') + this.checkedList.checked + } + this.stockCheck() + }, + stockCheck() { + this.stockList = [] + let obj = { + marketPrice: '', + sellPrice: '', + stock: '', + integral: '' + } + if (this.attributesList.length == 1) { + let data = {} + let name = this.attributesList[0].attributeName + let value = this.radioAttributes + data[name] = value + obj.attributeJson = JSON.stringify(data) + this.stockList.push(obj) + } else { + this.attributesList.forEach((item, ind) => { + if (ind != 0) { + this.checkboxAttributes.forEach((tab, index) => { + let data = {} + let tabName = this.attributesList[ind].attributeName + let tabValue = tab + data[tabName] = tabValue + obj.attributeJson = JSON.stringify(data) + let stockObj = JSON.parse(JSON.stringify(obj)) + this.stockList.push(stockObj) + }) + } + }) + + + } + }, + deleteCheckAll(i) { + if (this.checkboxAttributes.length > 1) { + this.checkboxAttributes.splice(i, 1) + } else { + this.checkboxAttributes.splice(i, 1) + this.radioAttributes = '' + } + this.stockList.splice(i, 1) + }, + deleteRadio() { + this.radioAttributes = '' + }, + changeChecked(item) { + item.checked = !item.checked + }, + addStockList() { + this.stockList.forEach(tab => { + tab.marketPrice = this.bottonList[0].marketPrice + tab.sellPrice = this.bottonList[0].sellPrice + tab.stock = this.bottonList[0].stock + tab.integral = this.bottonList[0].integral + }) + }, + //调起上传图片 + srcFileImage() { + let _that = this let imageUrl = '' - uni.chooseImage({ - count: 10, //默认9 - sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 - sourceType: ['album'], //从相册选择 - success: function(res) { - console.log(res) - const JSESSIONID = utils.uuid() - uni.uploadFile({ - url: 'http://uat.xingoil.com/adminapi/oil-oss/obejct/uploadFile', - filePath: res.tempFilePaths[0], - formData: { - ossKey: 'xingyou', - pathKey: 'publicxingyou', - encrypt: 'PUBLIC', - }, - name: 'file', - header: { - "Content-Type": "multipart/form-data", - "Authorization": uni.getStorageSync('Authorization'), - 'dataSources': 'MP', - "imei": uni.getStorageSync('unionid'), - "openId": uni.getStorageSync('openid'), - 'JSESSIONID': JSESSIONID, - 'token': utils.md5Salt(JSESSIONID) - }, - success(e) { - let obj = JSON.parse(e.data), - imageUrl = obj.data.publicUrl - _that.getImage(imageUrl) - }, - fail(err) { - } - }) - },fail() { - console.log('相机调用失败') - } - }) - }, - getImage(imageUrl){ - if(JSON.stringify(this.productDate.images) == '[]'){ - this.productDate.images.push({ - url:imageUrl, - mainMark:1 - }) - }else{ - this.productDate.images.push({ - url:imageUrl, - mainMark:'' - }) - } - }, - setMainImage(index){ - this.productDate.images.forEach((tab,i)=>{ - if(i == index){ - tab.mainMark = 1 - }else{ - tab.mainMark = '' - } - }) - }, - clearImage(index){ - if(this.productDate.images[index].mainMark == 1){ - this.productDate.images.splice(index,1) + uni.chooseImage({ + count: 10, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album'], //从相册选择 + success: function(res) { + const JSESSIONID = utils.uuid() + uni.uploadFile({ + url: 'http://uat.xingoil.com/adminapi/oil-oss/obejct/uploadFile', + filePath: res.tempFilePaths[0], + formData: { + ossKey: 'xingyou', + pathKey: 'publicxingyou', + encrypt: 'PUBLIC', + }, + name: 'file', + header: { + "Content-Type": "multipart/form-data", + "Authorization": uni.getStorageSync('Authorization'), + 'dataSources': 'MP', + "imei": uni.getStorageSync('unionid'), + "openId": uni.getStorageSync('openid'), + 'JSESSIONID': JSESSIONID, + 'token': utils.md5Salt(JSESSIONID) + }, + success(e) { + let obj = JSON.parse(e.data), + imageUrl = obj.data.publicUrl + _that.getImage(imageUrl) + }, + fail(err) {} + }) + }, + fail() { + console.log('相机调用失败') + } + }) + }, + getImage(imageUrl) { + if (JSON.stringify(this.productDate.images) == '[]') { + this.productDate.images.push({ + url: imageUrl, + mainMark: 1 + }) + } else { + this.productDate.images.push({ + url: imageUrl, + mainMark: '' + }) + } + }, + setMainImage(items, index) { + let obj = items + obj.mainMark = 1 + this.productDate.images.splice(index, 1) + this.productDate.images.forEach((tab, i) => { + tab.mainMark = '' + }) + + this.productDate.images.unshift(obj) + }, + 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) + } else { + this.productDate.images.splice(index, 1) } - }, - closed(){ - uni.navigateTo({ - url: '/pages/index/index' - }) - }, - addCompleted(){ - if(this.radioItem[0].checked =true){ + }, + closed() { + uni.navigateTo({ + url: '/pages/index/index' + }) + }, + addCompleted() { + if (this.radioItem[0].checked = true) { this.productDate.newMark == '1' - }else{ - this.productDate.newMark == '2' - } - if(this.radioItem[1].checked =true){ - this.productDate.recommend == '1' - }else{ - this.productDate.recommend == '2' - } - this.productDate.checkedList = this.checkedList - this.productDate.stockList = this.stockList - serve.saveProduct(this.productDate).then(res=>{ - console.log(res) - uni.showToast({ - title: res.msg, - icon: 'none' - }) - this.closed() - }) - } + } else { + this.productDate.newMark == '2' + } + if (this.radioItem[1].checked = true) { + this.productDate.recommend == '1' + } else { + this.productDate.recommend == '2' + } + this.productDate.checkedList = this.checkedList + this.productDate.stockList = this.stockList + serve.saveProduct(this.productDate).then(res => { + uni.showToast({ + title: res.msg, + icon: 'none' + }) + this.closed() + }) + } } } + } + + .checked { + color: #FFFFFF; + background: #FE0606; + border: 1rpx solid #FE0606; + } + + .checkbox checkbox { + display: none + } + + + + + .buttons { + width: 100%; + display: flex; + justify-content: space-evenly; + margin-top: 180rpx; + + >view { + width: 250rpx; + height: 76rpx; + text-align: center; + line-height: 76rpx; + border-radius: 10rpx; + font-size: 28rpx; + + &:nth-of-type(1) { + background: #FFFFFF; + border: 1rpx solid #B6B6B6; + color: #333; + } + + &:nth-of-type(2) { + background: #FE0505; + color: #fff; + } + } + } + + .show { + display: flex; + flex-wrap: wrap; + } + + .hidden { + display: none; + } + \ No newline at end of file diff --git a/packageIntegral/productList/index.vue b/packageIntegral/productList/index.vue index 6a7a5dd..a1b0ed8 100644 --- a/packageIntegral/productList/index.vue +++ b/packageIntegral/productList/index.vue @@ -10,16 +10,15 @@ @click="selectOptions(index)">{{item.text}}({{item.count}}) - + - {{item.productStatus =='1'?'已上架':'未上架'}} @@ -29,7 +28,8 @@ 库存:{{item.totalStock}} {{statusEnum[item.auditStatus].value}} + :style="{background:statusEnum[item.auditStatus].color}">{{statusEnum[item.auditStatus].value}} + 删除 编辑 @@ -128,7 +128,7 @@ count: 0, value: '' }], - identifying:{ + identifying: { 1: { background: '#F83D3D', opacity: 1, @@ -154,8 +154,8 @@ value: "已驳回" }, }, - examineDetailList:[], - productData:{} + examineDetailList: [], + productData: {} } }, @@ -167,17 +167,17 @@ methods: { selectOptions(index) { this.currentIndex = index - console.log(index,'index') - if(index == 0){ - this.paramter.params ={} - }else if(index ==1){ - this.paramter.params ={} + console.log(index, 'index') + if (index == 0) { + this.paramter.params = {} + } else if (index == 1) { + this.paramter.params = {} this.paramter.params.productStatus = 1 - }else if(index ==2){ - this.paramter.params ={} + } else if (index == 2) { + this.paramter.params = {} this.paramter.params.productStatus = 2 - }else if(index ==3){ - this.paramter.params ={} + } else if (index == 3) { + this.paramter.params = {} this.paramter.params.auditStatus = 1 } this.productByPage() @@ -197,7 +197,7 @@ // url: `../orderDetails/index?orderId=${item.id}` // }) // }, - getTopInfo(){ + getTopInfo() { serve.getTopInfo(this.paramter).then(res => { if (res.code === 20000) { this.optionsList[0].count = res.data.count @@ -233,16 +233,18 @@ this.paramter.currentPage += 1 this.productByPage() }, - examineDetail(item){ - serve.productAuditHistory({id:item.id}).then(res=>{ + examineDetail(item) { + serve.productAuditHistory({ + id: item.id + }).then(res => { this.examineDetailList = res.data }) this.$refs.detail.open('center') }, - orderDelete(){ + orderDelete() { this.$refs.delete.open('center') }, - toEditOrder(item){ + toEditOrder(item) { uni.navigateTo({ url: `../productUpdate/index?id=${item.id}` }) @@ -252,16 +254,16 @@ this.productData = item this.$refs.popup.open('center') }, - submitProduct(){ + submitProduct() { let data = {} data.id = this.productData.id - if(this.productData.productStatus ==1){ + if (this.productData.productStatus == 1) { data.productStatus = 2 - }else if(this.productData.productStatus ==2){ + } else if (this.productData.productStatus == 2) { data.productStatus = 1 } - serve.productStatus(data).then(res=>{ + serve.productStatus(data).then(res => { uni.showToast({ title: res.msg, icon: 'none' @@ -297,6 +299,7 @@ background: #FFF; } + >.options-frame { display: flex; justify-content: space-between; @@ -354,7 +357,7 @@ color: #666; border-top: 1rpx solid #D7D7D7; - .identifying{ + .identifying { width: 120rpx; height: 60rpx; line-height: 60rpx; @@ -404,7 +407,8 @@ } } } - .examine{ + + .examine { width: 120rpx; height: 45rpx; color: #FFF; @@ -438,14 +442,16 @@ border-radius: 10rpx; } - >.button{ - &:nth-of-type(1){ + >.button { + &:nth-of-type(1) { right: 360rpx; } - &:nth-of-type(2){ + + &:nth-of-type(2) { right: 200rpx; } - &:nth-of-type(3){ + + &:nth-of-type(3) { right: 40rpx; } @@ -467,30 +473,35 @@ color: #000; margin-bottom: 20rpx; } - >uni-icons{ + + >uni-icons { position: absolute; top: 30rpx; right: 30rpx; } - >.item{ + + >.item { display: flex; justify-content: space-evenly; overflow-y: hidden; font-size: 22rpx; color: #666; padding: 10rpx; - view{ + + view { width: 240rpx; line-height: 46rpx; } - >.status{ + + >.status { width: 160rpx; - >view{ + + >view { width: 160rpx; } } - .header{ + .header { font-size: 32rpx; color: #000; } @@ -574,4 +585,4 @@ } } - + \ No newline at end of file diff --git a/packageIntegral/productUpdate/index.vue b/packageIntegral/productUpdate/index.vue index 0f9f715..4b5748b 100644 --- a/packageIntegral/productUpdate/index.vue +++ b/packageIntegral/productUpdate/index.vue @@ -2,147 +2,156 @@ 返回 - 新增商品 + 编辑商品 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 取消 - 下一步 + 下一步 - - - - - + + + + + 商品类型: - - {{item.attributeName}}: - - - - - - - + + {{item.attributeName}}: + + + + + + + 批量填充:批量填充填入信息后,可以批量将内容填写到SKU 信息里 - {{item.label}} - 确定 + + + + + + + + + + + + + + 确定 + + + - + * 规格: - {{radioAttributes}} - {{radioAttributes}}+{{checkboxAttributes[index]}} + {{radioAttributes}} + {{radioAttributes}}+{{checkboxAttributes[index]}} - + - + - + - + - 删除 + 删除 * 商品图片: 最多可上传10张图片 + + + + + 商品主图 + - - - - 商品主图 - - - - - 设为主图 - - + + + 设为主图 + - - - - + + + + + - - - 上一步 - 完成 + + + 上一步 + 完成 + - @@ -155,102 +164,129 @@ import serve from '@/api/packageIntegral/productList.js' import mulpicker from '@/packageIntegral/components/mulpicker.vue' export default { - components: { - mulpicker - }, + components: { + mulpicker + }, data() { return { currentBoxId: 'chooseType', //当前显示的view的id isBoxShow: false, - productDate:{ - productStatus:'1', - images:[] + productDate: { + productStatus: '1', + images: [] + }, + productList: [], + brandIdList: [], + radioItem: [{ + name: '新品', + checked: true + }, { + name: '推荐', + checked: false + }], + rules: { + demandRegion: { + rules: [{ + required: true, + errorMessage: '请选择商品分类' + }] + }, + productName: { + rules: [{ + required: true, + errorMessage: '请输入商品名称' + }] + }, + brandId: { + rules: [{ + required: true, + errorMessage: '请选择商品品牌' + }] + }, + price: { + rules: [{ + required: true, + errorMessage: '请输入商品售价' + }] + }, }, - productList:[], - brandIdList:[], - radioItem:[{ - name: '新品', - checked: true - }, { - name: '推荐', - checked: false - }], - rules:{ - demandRegion:{rules:[{required: true,errorMessage: '请选择商品分类'}]}, - productName:{rules:[{required: true,errorMessage: '请输入商品名称'}]}, - brandId:{rules:[{required: true,errorMessage: '请选择商品品牌'}]}, - price:{rules:[{required: true,errorMessage: '请输入商品售价'}]}, - }, - attributesTypeList:[], - attributesList:[], - bottonList:[ - {label:'市场价格',value:'marketPrice',checked:false}, - {label:'销售价格',value:'sellPrice',checked:false}, - {label:'商品库存',value:'stock',checked:false}, - {label:'兑换积分',value:'integral',checked:false} - ], - radioAttributes:'', - checkboxAttributes:[], - stockList:[], - checkedList:[] + attributesTypeList: [], + attributesList: [], + bottonList: [{ + marketPrice: '', + sellPrice: '', + stock: '', + integral: '' + }], + radioAttributes: '', + checkboxAttributes: [], + stockList: [], + checkedList: [] } }, onLoad(options) { - console.log(options,'options') this.getEdit(options) this.classfication() this.getProductBrands() this.getAttributesType() }, - watch:{ - 'productDate.demandRegion'(val){ - if(val){ + watch: { + 'productDate.demandRegion'(val) { + if (val) { this.productDate.categoryOneId = val.split(',')[0] this.productDate.categoryTwoId = val.split(',')[1] } }, - 'productDate.attributesTypeId'(val){ - if(!val){ - this.stockList = [] - } - } + 'productDate.attributesTypeId'(val) { + if (!val) { + this.stockList = [] + } + } }, methods: { - getEdit(options){ - serve.getEdit(options.id).then(res=>{ - if(res.code === 20000&&res.data!=null){ + getEdit(options) { + serve.getEdit(options.id).then(res => { + if (res.code === 20000 && res.data != null) { this.productDate = res.data - this.productDate.demandRegion = res.data.categoryOneId+','+res.data.categoryTwoId - if(this.productDate.newMark == '1'){ - this.radioItem[0].checked =true - }else{ - this.radioItem[0].checked =false + this.productDate.demandRegion = res.data.categoryOneId + ',' + res.data.categoryTwoId + if (this.productDate.newMark == '1') { + this.radioItem[0].checked = true + } else { + this.radioItem[0].checked = false } - if(this.productDate.recommend == '1'){ - this.radioItem[1].checked =true - }else{ - this.radioItem[1].checked =false + if (this.productDate.recommend == '1') { + this.radioItem[1].checked = true + } else { + this.radioItem[1].checked = false } - this.attributesTypeList.forEach(tab=>{ - if(tab.id = this.productDate.attributesTypeId){ + this.attributesTypeList.forEach(tab => { + if (tab.value == this.productDate.attributesTypeId) { this.attributesList = tab.attributesList - this.attributesList.forEach(tab=>{ + this.attributesList.forEach(tab => { tab.attributesList = [] - tab.attributeContent.split(',').forEach(item=>{ - tab.attributesList.push({value:item,text:item}) + tab.attributeContent.split(',').forEach(item => { + tab.attributesList.push({ + value: item, + text: item + }) }) }) } }) this.checkedList = this.productDate.checkedList - if(this.productDate.checkedList.length==1){ + if (this.productDate.checkedList.length == 1) { this.radioAttributes = this.productDate.checkedList[0].checked - }else{ + } else { this.checkboxAttributes = [] - this.productDate.checkedList.forEach((tab,index)=>{ - if(index!=0){ - this.checkboxAttributes.push(tab.checked) + this.productDate.checkedList.forEach((tab, index) => { + if (index == 0) { + this.radioAttributes = this.productDate.checkedList[0].checked + } else { + tab.checked.split(',').forEach(item => { + this.checkboxAttributes.push(item) + }) + } }) } @@ -258,498 +294,561 @@ } - console.log(res.data) }) }, - switchChange(e){ - if(e.detail.value == true){ + switchChange(e) { + if (e.detail.value == true) { this.productDate.productStatus = '1' - }else if(e.detail.value == false){ + } else if (e.detail.value == false) { this.productDate.productStatus = '2' } }, - classfication(){ - serve.classification().then(res=>{ + classfication() { + serve.classification().then(res => { this.productList = res.data }) }, - getProductBrands(){ + getProductBrands() { this.brandIdList = [] - serve.getProductBrands().then(res=>{ - console.log(res) - res.data.forEach(tab=>{ - this.brandIdList.push({value:tab.id,text:tab.brandName}) + serve.getProductBrands().then(res => { + res.data.forEach(tab => { + this.brandIdList.push({ + value: tab.id, + text: tab.brandName + }) }) }) }, - checkbox (e) { - var index = e;//获取当前点击的下标 - var checkboxArr = this.radioItem;//选项集合 - // if (checkboxArr[index].checked) return;//如果点击的当前已选中则返回 - // checkboxArr.forEach(item => { - // item.checked = false - // }) - if(checkboxArr[index].checked ==false){ - checkboxArr[index].checked = true; //改变当前选中的checked值 - - }else { - checkboxArr[index].checked = false; //改变当前选中的checked值 - } - if(checkboxArr[0].checked ==true){ - this.productDate.newMark = 1 - }else{ - this.productDate.newMark = 2 - } - if(checkboxArr[1].checked ==true){ - this.productDate.recommend = 1 - }else{ - this.productDate.recommend = 2 - } - - }, - changeBox(e){ - let currentFlag = e.currentTarget.id; - if(currentFlag == 'next'){ - this.$refs.productForm.validate().then(res=>{ - console.log('表单数据信息:', res); - switch(currentFlag){ - case 'next': - this.currentBoxId = 'instruction' - break; - case 'previous': - this.currentBoxId = 'chooseType' - break; - default: - this.currentBoxId = 'viewInstruction' - break; - } - if(currentFlag == 'next'){ - this.getAttributesType() - } - }).catch(err =>{ - console.log('表单错误信息:', err); - }) - }else{ - switch(currentFlag){ - case 'next': - this.currentBoxId = 'instruction' - break; - case 'previous': - this.currentBoxId = 'chooseType' - break; - default: - this.currentBoxId = 'viewInstruction' - break; - } - } - - }, - getAttributesType(){ - this.attributesTypeList = [] - serve.getAttributesType().then(res=>{ - res.data.forEach(tab=>{ + checkbox(e) { + var index = e; //获取当前点击的下标 + var checkboxArr = this.radioItem; //选项集合 + // if (checkboxArr[index].checked) return;//如果点击的当前已选中则返回 + // checkboxArr.forEach(item => { + // item.checked = false + // }) + if (checkboxArr[index].checked == false) { + checkboxArr[index].checked = true; //改变当前选中的checked值 + + } else { + checkboxArr[index].checked = false; //改变当前选中的checked值 + } + if (checkboxArr[0].checked == true) { + this.productDate.newMark = 1 + } else { + this.productDate.newMark = 2 + } + if (checkboxArr[1].checked == true) { + this.productDate.recommend = 1 + } else { + this.productDate.recommend = 2 + } + + }, + changeBox(e) { + let currentFlag = e.currentTarget.id; + if (currentFlag == 'next') { + this.$refs.productForm.validate().then(res => { + switch (currentFlag) { + case 'next': + this.currentBoxId = 'instruction' + break; + case 'previous': + this.currentBoxId = 'chooseType' + break; + default: + this.currentBoxId = 'viewInstruction' + break; + } + if (currentFlag == 'next') { + this.getAttributesType() + } + }).catch(err => {}) + } else { + switch (currentFlag) { + case 'next': + this.currentBoxId = 'instruction' + break; + case 'previous': + this.currentBoxId = 'chooseType' + break; + default: + this.currentBoxId = 'viewInstruction' + break; + } + } + + }, + getAttributesType() { + this.attributesTypeList = [] + serve.getAttributesType().then(res => { + res.data.forEach(tab => { this.attributesTypeList.push({ - value:tab.id, - text:tab.name, - number:tab.number, - attributesList:tab.attributesList + value: tab.id, + text: tab.name, + number: tab.number, + attributesList: tab.attributesList + }) + }) + }) + }, + attributesData() { + this.bottonList = [{ + marketPrice: '', + sellPrice: '', + stock: '', + integral: '' + }] + this.stockList = [] + this.radioAttributes = '' + this.checkboxAttributes = [] + if (this.productDate.attributesTypeId) { + this.attributesTypeList.forEach(tab => { + if (tab.value == this.productDate.attributesTypeId) { + this.attributesList = tab.attributesList + this.attributesList.forEach(tab => { + tab.attributesList = [] + tab.attributeContent.split(',').forEach(item => { + tab.attributesList.push({ + value: item, + text: item + }) + }) }) + + } }) + } else { + this.attributesList = [] + } + + }, + changeRadio(item, index) { + if (JSON.stringify(this.checkedList) == '[]') { + this.checkedList.push({ + attributeId: item.id, + checked: this.radioAttributes + }) + } else { + this.checkedList[index].checked = this.radioAttributes + } + this.stockCheck() + + }, + changeCheckBox(item, index) { + if (this.checkedList.length < index + 1) { + this.checkedList.push({ + attributeId: item.id, + checked: this.radioAttributes + }) + } else { + let checked = [] + this.checkboxAttributes.forEach(tab => { + checked.push(tab) + }) + this.checkedList[index].checked = checked.join(',') + this.checkedList.checked + } + this.stockCheck() + + }, + stockCheck() { + this.stockList = [] + let obj = { + marketPrice: '', + sellPrice: '', + stock: '', + integral: '' + } + if (this.attributesList.length == 1) { + let data = {} + let name = this.attributesList[0].attributeName + let value = this.radioAttributes + data[name] = value + obj.attributeJson = JSON.stringify(data) + this.stockList.push(obj) + } else { + this.attributesList.forEach((item, ind) => { + if (ind != 0) { + this.checkboxAttributes.forEach((tab, index) => { + let data = {} + let tabName = this.attributesList[ind].attributeName + let tabValue = tab + data[tabName] = tabValue + obj.attributeJson = JSON.stringify(data) + let stockObj = JSON.parse(JSON.stringify(obj)) + this.stockList.push(stockObj) + }) + } + }) + + + } + }, + deleteCheckAll(i) { + if (this.checkboxAttributes.length > 1) { + this.checkboxAttributes.splice(i, 1) + } else { + this.checkboxAttributes.splice(i, 1) + this.radioAttributes = '' + } + this.stockList.splice(i, 1) + }, + deleteRadio() { + this.radioAttributes = '' + }, + addStockList() { + this.stockList.forEach(tab => { + tab.marketPrice = this.bottonList[0].marketPrice + tab.sellPrice = this.bottonList[0].sellPrice + tab.stock = this.bottonList[0].stock + tab.integral = this.bottonList[0].integral }) - }, - attributesData(){ - if(this.productDate.attributesTypeId){ - this.attributesTypeList.forEach(tab=>{ - if(tab.id = this.productDate.attributesTypeId){ - this.attributesList = tab.attributesList - this.attributesList.forEach(tab=>{ - tab.attributesList = [] - tab.attributeContent.split(',').forEach(item=>{ - tab.attributesList.push({value:item,text:item}) - }) - }) - - } - }) - }else{ - this.attributesList = [] - } - - }, - changeRadio(item,index){ - if(JSON.stringify(this.checkedList) == '[]'){ - this.checkedList.push({attributeId:item.id,checked:item.attributeName}) - }else{ - this.checkedList[index].checked = item.attributeName - } - }, - changeCheckBox(item,index){ - if(this.checkedList.length{ - checked.push(tab) - }) - this.checkedList[index].checked = checked.join(',') - this.checkedList.checked - } - }, - deleteCheckAll(i){ - if(this.checkboxAttributes.length>1){ - this.checkboxAttributes.splice(i,1) - }else{ - this.checkboxAttributes.splice(i,1) - this.radioAttributes = '' - } - this.stockList.splice(i,1) - }, - deleteRadio(){ - this.radioAttributes = '' - }, - changeChecked(item){ - item.checked = !item.checked - }, - addStockList(){ - this.stockList = [] - let obj = { - marketPrice:'', - sellPrice:'', - stock:'', - integral:'' - } - if(this.attributesList.length ==1){ - let data = {} - let name = this.attributesList[0].attributeName - let value = this.radioAttributes - data[name] = value - obj.attributeJson = JSON.stringify(data) - this.stockList.push(obj) - }else{ - this.checkboxAttributes.forEach((tab,index)=>{ - let name = this.attributesList[0].attributeName - let value = this.radioAttributes - let tabName = this.attributesList[index+1].attributeName - let tabValue = tab - data[name] = value - data[tabName] = tabValue - obj.attributeJson = JSON.stringify(data) - this.stockList.push(obj) - }) - - } - }, - //调起上传图片 - srcFileImage() { - let _that = this + }, + //调起上传图片 + srcFileImage() { + let _that = this let imageUrl = '' - uni.chooseImage({ - count: 10, //默认9 - sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 - sourceType: ['album'], //从相册选择 - success: function(res) { - const JSESSIONID = utils.uuid() - uni.uploadFile({ - url: 'http://uat.xingoil.com/adminapi/oil-oss/obejct/uploadFile', - filePath: res.tempFilePaths[0], - formData: { - ossKey: 'xingyou', - pathKey: 'publicxingyou', - encrypt: 'PUBLIC', - }, - name: 'file', - header: { - "Content-Type": "multipart/form-data", - "Authorization": uni.getStorageSync('Authorization'), - 'dataSources': 'MP', - "imei": uni.getStorageSync('unionid'), - "openId": uni.getStorageSync('openid'), - 'JSESSIONID': JSESSIONID, - 'token': utils.md5Salt(JSESSIONID) - }, - success(e) { - let obj = JSON.parse(e.data), - imageUrl = obj.data.publicUrl - _that.getImage(imageUrl) - }, - fail(err) { - } - }) - },fail() { - console.log('相机调用失败') - } - }) - }, - getImage(imageUrl){ - if(JSON.stringify(this.productDate.images) == '[]'){ - this.productDate.images.push({ - url:imageUrl, - mainMark:1 - }) - }else{ - this.productDate.images.push({ - url:imageUrl, - mainMark:'' - }) - } - }, - setMainImage(index){ - this.productDate.images.forEach((tab,i)=>{ - if(i == index){ - tab.mainMark = 1 - }else{ - tab.mainMark = '' - } - }) - }, - clearImage(index){ - if(this.productDate.images[index].mainMark == 1){ - this.productDate.images.splice(index,1) + uni.chooseImage({ + count: 10, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album'], //从相册选择 + success: function(res) { + const JSESSIONID = utils.uuid() + uni.uploadFile({ + url: 'http://uat.xingoil.com/adminapi/oil-oss/obejct/uploadFile', + filePath: res.tempFilePaths[0], + formData: { + ossKey: 'xingyou', + pathKey: 'publicxingyou', + encrypt: 'PUBLIC', + }, + name: 'file', + header: { + "Content-Type": "multipart/form-data", + "Authorization": uni.getStorageSync('Authorization'), + 'dataSources': 'MP', + "imei": uni.getStorageSync('unionid'), + "openId": uni.getStorageSync('openid'), + 'JSESSIONID': JSESSIONID, + 'token': utils.md5Salt(JSESSIONID) + }, + success(e) { + let obj = JSON.parse(e.data), + imageUrl = obj.data.publicUrl + _that.getImage(imageUrl) + }, + fail(err) {} + }) + }, + fail() { + console.log('相机调用失败') + } + }) + }, + getImage(imageUrl) { + if (JSON.stringify(this.productDate.images) == '[]') { + this.productDate.images.push({ + url: imageUrl, + mainMark: 1 + }) + } else { + this.productDate.images.push({ + url: imageUrl, + mainMark: '' + }) + } + }, + setMainImage(items, index) { + let obj = items + obj.mainMark = 1 + this.productDate.images.splice(index, 1) + this.productDate.images.forEach((tab, i) => { + tab.mainMark = '' + }) + + this.productDate.images.unshift(obj) + }, + 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) + } else { + this.productDate.images.splice(index, 1) } - }, - closed(){ - uni.navigateBack() - }, - addCompleted(){ - if(this.radioItem[0].checked =true){ + }, + closed() { + uni.navigateBack() + }, + addCompleted() { + if (this.radioItem[0].checked = true) { this.productDate.newMark == '1' - }else{ - this.productDate.newMark == '2' - } - if(this.radioItem[1].checked =true){ - this.productDate.recommend == '1' - }else{ - this.productDate.recommend == '2' - } - this.productDate.checkedList = this.checkedList - this.productDate.stockList = this.stockList - serve.updateProduct(this.productDate).then(res=>{ - uni.showToast({ - title: res.msg, - icon: 'none' - }) - uni.navigateTo({ - url: `../productList/index` - }) - }) - } + } else { + this.productDate.newMark == '2' + } + if (this.radioItem[1].checked = true) { + this.productDate.recommend == '1' + } else { + this.productDate.recommend == '2' + } + this.productDate.checkedList = this.checkedList + this.productDate.stockList = this.stockList + serve.updateProduct(this.productDate).then(res => { + uni.showToast({ + title: res.msg, + icon: 'none' + }) + uni.navigateTo({ + url: `../productList/index` + }) + }) + } } } + } + + .show { + display: flex; + flex-wrap: wrap; + } + + .hidden { + display: none; + } + \ No newline at end of file diff --git a/pages.json b/pages.json index 5a51986..74e0572 100644 --- a/pages.json +++ b/pages.json @@ -108,6 +108,21 @@ "style": {} }] }, + { + "root": "packageElectron", + "pages": [{ + "path": "index", + "style": {} + }, + { + "path": "reconciliationDetails/index", + "style": {} + }, { + "path": "components/autograph", + "style": {} + } + ] + }, { "root": "packageOrders", "pages": [{ diff --git a/pages/home/home.vue b/pages/home/home.vue index fd18300..0d0bd4c 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -445,6 +445,12 @@ obj.color = 'blue', obj.badge = 0 obj.name = list.roleName + }else if (list.roleName == '电子对账单') { + obj.cuIcon = 'punch', + obj.path = '/packageElectron/index', + obj.color = 'blue', + obj.badge = 0 + obj.name = list.roleName } return obj },