From dfbafd8ea803aab41d4477834ad80c6e8d5bf5e9 Mon Sep 17 00:00:00 2001 From: zhangyouji Date: Tue, 16 Apr 2024 17:16:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E5=AD=90=E7=BB=93=E7=AE=97=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/packageElectron/packageElectron.js | 18 + api/packageIntegral/productList.js | 7 + components/my-sign/index.js | 16 + components/my-sign/my-sign.vue | 320 ++++++++++++++++++ packageElectron/components/autograph.vue | 188 +++++++++- packageElectron/index.vue | 257 ++++++-------- .../reconciliationDetails/index.vue | 192 ++++++++++- packageIntegral/productAddition/index.vue | 168 +++++++-- packageIntegral/productList/index.vue | 23 +- packageIntegral/productUpdate/index.vue | 169 +++++++-- pages.json | 20 +- 11 files changed, 1171 insertions(+), 207 deletions(-) create mode 100644 api/packageElectron/packageElectron.js create mode 100644 components/my-sign/index.js create mode 100644 components/my-sign/my-sign.vue diff --git a/api/packageElectron/packageElectron.js b/api/packageElectron/packageElectron.js new file mode 100644 index 0000000..0e69b48 --- /dev/null +++ b/api/packageElectron/packageElectron.js @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +export default{ + getByPage(data) { + return request({ + url: `/oil-finance/xoilSiteElectronicStatement/getByPage`, + method: 'post', + data + }) + }, + update(data) { + return request({ + url: `/oil-finance/xoilSiteElectronicStatement/update`, + method: 'PUT', + data + }) + } +} \ No newline at end of file diff --git a/api/packageIntegral/productList.js b/api/packageIntegral/productList.js index 84df717..6077a23 100644 --- a/api/packageIntegral/productList.js +++ b/api/packageIntegral/productList.js @@ -66,4 +66,11 @@ export default{ data }) }, + deleteProductById(data) { // 删除商品接口 + return request({ + url: `/oil-mall/mobile/deleteProductById`, + method: 'post', + data + }) + }, } \ No newline at end of file diff --git a/components/my-sign/index.js b/components/my-sign/index.js new file mode 100644 index 0000000..ab58258 --- /dev/null +++ b/components/my-sign/index.js @@ -0,0 +1,16 @@ +/** + * 判断是否未数值 + * @param {Object} val + */ +export function isNumber(val) { + return !isNaN(Number(val)) +} + +/** + * 处理大小单位 + * @param {Object} val + */ +export function formatSize(val, unit = 'rpx') { + return isNumber(val) ? `${val}${unit}` : val +} + diff --git a/components/my-sign/my-sign.vue b/components/my-sign/my-sign.vue new file mode 100644 index 0000000..352095a --- /dev/null +++ b/components/my-sign/my-sign.vue @@ -0,0 +1,320 @@ + + + + + diff --git a/packageElectron/components/autograph.vue b/packageElectron/components/autograph.vue index 02409e3..39d4cc0 100644 --- a/packageElectron/components/autograph.vue +++ b/packageElectron/components/autograph.vue @@ -1,8 +1,192 @@ - \ No newline at end of file + + diff --git a/packageElectron/index.vue b/packageElectron/index.vue index ff853b0..e991e75 100644 --- a/packageElectron/index.vue +++ b/packageElectron/index.vue @@ -2,29 +2,33 @@ 返回 - 商品列表 + 电子对账单 {{item.text}}({{item.count}}) + @click="selectOptions(index)">{{item.text}} - - - {{item.productName}} - 规格:默认 - 库存:{{item.totalStock}} - - - 删除 - 编辑 + + {{item.id}} + + 结算周期: + {{item.beginReconciliationTime}}至 {{item.endReconciliationTime}} + + 结算金额:{{item.statementAmount}}元 + 推送时间:{{item.reviewTime?item.reviewTime:'暂无'}} + + 点击确认 + 已确认 + 金额有误 + + - @@ -35,12 +39,9 @@ - \ No newline at end of file diff --git a/packageIntegral/productAddition/index.vue b/packageIntegral/productAddition/index.vue index 54e42f7..7df9313 100644 --- a/packageIntegral/productAddition/index.vue +++ b/packageIntegral/productAddition/index.vue @@ -51,12 +51,12 @@ - + + placeholder="请选择规格" @change="attributesData"> - 商品类型: + 商品规格: @@ -170,6 +170,7 @@ isBoxShow: false, productDate: { productStatus: '1', + newMark: 1, images: [] }, productList: [], @@ -268,16 +269,18 @@ 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值 + if (checkboxArr[index].checked) return; //如果点击的当前已选中则返回 + checkboxArr.forEach(item => { + item.checked = false + }) + checkboxArr[index].checked = true; //改变当前选中的checked值 - } else { - checkboxArr[index].checked = false; //改变当前选中的checked值 - } + // 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 { @@ -294,6 +297,13 @@ let currentFlag = e.currentTarget.id; if (currentFlag == 'next') { this.$refs.productForm.validate().then(res => { + if (this.isNumber(this.productDate.price) == false) { + uni.showToast({ + title: '商品售价不是数字', + icon: 'none' + }) + return + } switch (currentFlag) { case 'next': this.currentBoxId = 'instruction' @@ -383,7 +393,7 @@ if (this.checkedList.length < index + 1) { this.checkedList.push({ attributeId: item.id, - checked: this.radioAttributes + checked: item.attributesList[index].value }) } else { let checked = [] @@ -456,7 +466,7 @@ let _that = this let imageUrl = '' uni.chooseImage({ - count: 10, //默认9 + count: 1, //默认9 sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 sourceType: ['album'], //从相册选择 success: function(res) { @@ -493,17 +503,25 @@ }) }, getImage(imageUrl) { - if (JSON.stringify(this.productDate.images) == '[]') { - this.productDate.images.push({ - url: imageUrl, - mainMark: 1 - }) + if (this.productDate.images.length < 10) { + if (JSON.stringify(this.productDate.images) == '[]') { + this.productDate.images.push({ + url: imageUrl, + mainMark: 1 + }) + } else { + this.productDate.images.push({ + url: imageUrl, + mainMark: '' + }) + } } else { - this.productDate.images.push({ - url: imageUrl, - mainMark: '' + uni.showToast({ + title: '最多只能上传十张图片~', + icon: 'none' }) } + }, setMainImage(items, index) { let obj = items @@ -528,6 +546,9 @@ url: '/pages/index/index' }) }, + isNumber(value) { + return /^[0-9]+$/.test(value); + }, addCompleted() { if (this.radioItem[0].checked = true) { this.productDate.newMark == '1' @@ -539,6 +560,109 @@ } else { this.productDate.recommend == '2' } + if (!this.productDate.attributesTypeId) { + uni.showToast({ + title: '请选择请选择规格', + icon: 'none' + }) + return + } + if(this.attributesList.length==1){ + if(!this.radioAttributes){ + uni.showToast({ + title: '请选择商品规格', + icon: 'none' + }) + return + } + } + if(this.attributesList.length>1){ + if(JSON.stringify(this.checkboxAttributes) == '[]'){ + uni.showToast({ + title: '请选择商品规格', + icon: 'none' + }) + return + } + } + if (JSON.stringify(this.stockList.length) == '[]') { + uni.showToast({ + title: '请选择商品规格', + icon: 'none' + }) + return + } else { + this.stockList.forEach(tab => { + + if (!tab.marketPrice) { + uni.showToast({ + title: '市场价格必填!', + icon: 'none' + }) + throw Error(`市场价格必填!`) + } else { + if (this.isNumber(tab.marketPrice) == false) { + uni.showToast({ + title: '市场价格不是数字!', + icon: 'none' + }) + throw Error(`市场价格不是数字!`) + } + } + if (!tab.sellPrice) { + uni.showToast({ + title: '销售价格必填!', + icon: 'none' + }) + throw Error(`销售价格必填!`) + } else { + if (this.isNumber(tab.sellPrice) == false) { + uni.showToast({ + title: '销售价格不是数字!', + icon: 'none' + }) + throw Error(`销售价格不是数字!`) + } + } + if (!tab.stock) { + uni.showToast({ + title: '库存数量必填!', + icon: 'none' + }) + throw Error(`库存数量必填!`) + } else { + if (this.isNumber(tab.stock) == false) { + uni.showToast({ + title: '库存数量不是数字!', + icon: 'none' + }) + throw Error(`库存数量不是数字!`) + } + } + if (!tab.integral) { + uni.showToast({ + title: '积分价值必填!', + icon: 'none' + }) + throw Error(`积分价值必填!`) + } else { + if (this.isNumber(tab.integral) == false) { + uni.showToast({ + title: '积分价值不是数字!', + icon: 'none' + }) + throw Error(`积分价值不是数字!`) + } + } + }) + } + if (JSON.stringify(this.productDate.images) == '[]') { + uni.showToast({ + title: '请上传商品图片', + icon: 'none' + }) + return + } this.productDate.checkedList = this.checkedList this.productDate.stockList = this.stockList serve.saveProduct(this.productDate).then(res => { diff --git a/packageIntegral/productList/index.vue b/packageIntegral/productList/index.vue index a1b0ed8..286d7ac 100644 --- a/packageIntegral/productList/index.vue +++ b/packageIntegral/productList/index.vue @@ -31,9 +31,9 @@ :style="{background:statusEnum[item.auditStatus].color}">{{statusEnum[item.auditStatus].value}} - 删除 + 删除 编辑 - {{item.productStatus =='1'?'上架':'下架'}} + {{item.productStatus =='1'?'下架':'上架'}} @@ -72,7 +72,7 @@ 是否删除该商品? 取消 - 确认 + 确认 @@ -167,7 +167,7 @@ methods: { selectOptions(index) { this.currentIndex = index - console.log(index, 'index') + this.paramter.currentPage = 1 if (index == 0) { this.paramter.params = {} } else if (index == 1) { @@ -215,7 +215,7 @@ productByPage() { serve.productByPage(this.paramter).then(res => { if (res.code === 20000) { - if (!res.data.list.length) { + if (!res.data.list.length&&this.paramter.currentPage!=1) { uni.showToast({ title: '没有更多订单啦~', icon: 'none' @@ -241,8 +241,19 @@ }) this.$refs.detail.open('center') }, - orderDelete() { + orderDelete(item) { this.$refs.delete.open('center') + this.deleteData = item + }, + deleteIntegral(){ + serve.deleteProductById({id:this.deleteData.id}).then(res=>{ + uni.showToast({ + title: res.msg, + icon: 'none' + }) + this.$refs.delete.close() + this.search() + }) }, toEditOrder(item) { uni.navigateTo({ diff --git a/packageIntegral/productUpdate/index.vue b/packageIntegral/productUpdate/index.vue index 4b5748b..6ad39e6 100644 --- a/packageIntegral/productUpdate/index.vue +++ b/packageIntegral/productUpdate/index.vue @@ -51,12 +51,12 @@ - + + placeholder="请选择规格" @change="attributesData"> - 商品类型: + 商品规格: @@ -323,16 +323,18 @@ 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值 + if (checkboxArr[index].checked) return; //如果点击的当前已选中则返回 + checkboxArr.forEach(item => { + item.checked = false + }) + checkboxArr[index].checked = true; //改变当前选中的checked值 - } else { - checkboxArr[index].checked = false; //改变当前选中的checked值 - } + // 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 { @@ -349,6 +351,13 @@ let currentFlag = e.currentTarget.id; if (currentFlag == 'next') { this.$refs.productForm.validate().then(res => { + if (this.isNumber(this.productDate.price) == false) { + uni.showToast({ + title: '商品售价请输入数字', + icon: 'none' + }) + return + } switch (currentFlag) { case 'next': this.currentBoxId = 'instruction' @@ -439,7 +448,7 @@ if (this.checkedList.length < index + 1) { this.checkedList.push({ attributeId: item.id, - checked: this.radioAttributes + checked: item.attributesList[index].value }) } else { let checked = [] @@ -541,21 +550,28 @@ fail(err) {} }) }, - fail() { - console.log('相机调用失败') + fail(err) { + console.log('相机调用失败',err) } }) }, getImage(imageUrl) { - if (JSON.stringify(this.productDate.images) == '[]') { - this.productDate.images.push({ - url: imageUrl, - mainMark: 1 - }) + if (this.productDate.images.length < 10) { + if (JSON.stringify(this.productDate.images) == '[]') { + this.productDate.images.push({ + url: imageUrl, + mainMark: 1 + }) + } else { + this.productDate.images.push({ + url: imageUrl, + mainMark: '' + }) + } } else { - this.productDate.images.push({ - url: imageUrl, - mainMark: '' + uni.showToast({ + title: '最多只能上传十张图片~', + icon: 'none' }) } }, @@ -580,6 +596,9 @@ closed() { uni.navigateBack() }, + isNumber(value) { + return /^[0-9]+$/.test(value); + }, addCompleted() { if (this.radioItem[0].checked = true) { this.productDate.newMark == '1' @@ -591,6 +610,108 @@ } else { this.productDate.recommend == '2' } + if(this.attributesList.length==1){ + if(!this.radioAttributes){ + uni.showToast({ + title: '请选择商品规格', + icon: 'none' + }) + return + } + } + if(this.attributesList.length>1){ + if(JSON.stringify(this.checkboxAttributes) == '[]'){ + uni.showToast({ + title: '请选择商品规格', + icon: 'none' + }) + return + } + } + if (!this.productDate.attributesTypeId) { + uni.showToast({ + title: '请选择规格', + icon: 'none' + }) + return + } + if (JSON.stringify(this.stockList.length) == '[]') { + uni.showToast({ + title: '请选择商品规格', + icon: 'none' + }) + return + } else { + this.stockList.forEach(tab => { + if (!tab.marketPrice) { + uni.showToast({ + title: '市场价格必填!', + icon: 'none' + }) + throw Error(`市场价格必填!`) + } else { + if (this.isNumber(tab.marketPrice) == false) { + uni.showToast({ + title: '市场价格不是数字!', + icon: 'none' + }) + throw Error(`市场价格不是数字!`) + } + } + if (!tab.sellPrice) { + uni.showToast({ + title: '销售价格必填!', + icon: 'none' + }) + throw Error(`销售价格必填!`) + } else { + if (this.isNumber(tab.sellPrice) == false) { + uni.showToast({ + title: '销售价格不是数字!', + icon: 'none' + }) + throw Error(`销售价格不是数字!`) + } + } + if (!tab.stock) { + uni.showToast({ + title: '库存数量必填!', + icon: 'none' + }) + throw Error(`库存数量必填!`) + } else { + if (this.isNumber(tab.stock) == false) { + uni.showToast({ + title: '库存数量不是数字!', + icon: 'none' + }) + throw Error(`库存数量不是数字!`) + } + } + if (!tab.integral) { + uni.showToast({ + title: '积分价值必填!', + icon: 'none' + }) + throw Error(`积分价值必填!`) + } else { + if (this.isNumber(tab.integral) == false) { + uni.showToast({ + title: '积分价值不是数字!', + icon: 'none' + }) + throw Error(`积分价值不是数字!`) + } + } + }) + } + if (JSON.stringify(this.productDate.images) == '[]') { + uni.showToast({ + title: '请上传商品图片', + icon: 'none' + }) + return + } this.productDate.checkedList = this.checkedList this.productDate.stockList = this.stockList serve.updateProduct(this.productDate).then(res => { @@ -598,7 +719,7 @@ title: res.msg, icon: 'none' }) - uni.navigateTo({ + wx.navigateBack({ url: `../productList/index` }) }) diff --git a/pages.json b/pages.json index 74e0572..462adcb 100644 --- a/pages.json +++ b/pages.json @@ -91,19 +91,19 @@ "pages": [{ "path": "takeGoods/index", "style": {} - },{ + }, { "path": "orderDetails/index", "style": {} - },{ + }, { "path": "orderList/index", "style": {} - },{ + }, { "path": "productList/index", "style": {} - },{ + }, { "path": "productAddition/index", "style": {} - },{ + }, { "path": "productUpdate/index", "style": {} }] @@ -119,7 +119,13 @@ "style": {} }, { "path": "components/autograph", - "style": {} + "style": { + "navigationBarTitleText": "签字", + "enablePullDownRefresh": false, + "pageOrientation": "landscape", + "backgroundColor": "#f8f8f8", + "navigationStyle": "custom" + } } ] }, @@ -299,4 +305,4 @@ } -} +} \ No newline at end of file