From 0645e77bcebc4397d565de240372980e83f31281 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Wed, 15 Jun 2022 11:09:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8A=A5=E4=BF=AE=20?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=20=E4=B8=8A=E7=9A=84=E9=83=A8?= =?UTF-8?q?=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../select-single-resource.vue | 289 ++++++++++-------- pages/repairHandle/repairHandle.vue | 14 +- 2 files changed, 165 insertions(+), 138 deletions(-) diff --git a/components/select-single-resource/select-single-resource.vue b/components/select-single-resource/select-single-resource.vue index bc31005..ff428af 100644 --- a/components/select-single-resource/select-single-resource.vue +++ b/components/select-single-resource/select-single-resource.vue @@ -1,71 +1,95 @@ @@ -77,11 +101,12 @@ queryResourceStoreResName, queryRepairInfo } from '../../api/repair/repair.js' - import {getCurrentCommunity} from '../../api/community/community.js' + import { + getCurrentCommunity + } from '../../api/community/community.js' export default { - components: { - }, + components: {}, data() { return { showModel: false, @@ -118,27 +143,23 @@ type: String } }, - - watch: { - }, - - created() { - }, - - computed: { - }, - mounted() { - }, + watch: {}, + + created() {}, + + computed: {}, + + mounted() {}, methods: { - - switchShow: function(){ + + switchShow: function() { this.resetData(); this.showModel = !this.showModel; }, - - resetData: function(){ + + resetData: function() { let _that = this; let initData = { showModel: false, @@ -172,16 +193,16 @@ this.copyObject(initData, _that); this._loadRepairGoodsType(); }, - - copyObject: function (org, dst) { + + copyObject: function(org, dst) { for (let key in dst) { if (org.hasOwnProperty(key)) { dst[key] = org[key] } } }, - - _loadRepairGoodsType: function(){ + + _loadRepairGoodsType: function() { let _that = this; let _data = { page: 1, @@ -195,17 +216,17 @@ _that._appendCustomResourceStoreType(); }); }, - + // 追加自定义类 - _appendCustomResourceStoreType: function () { - let customeType = { - rstId: 'custom', - name: '自定义' - }; - this.goodsTypeCloums.push(customeType); - }, - - _loadRepairGoods: function(){ + _appendCustomResourceStoreType: function() { + let customeType = { + rstId: 'custom', + name: '自定义' + }; + this.goodsTypeCloums.push(customeType); + }, + + _loadRepairGoods: function() { let _that = this; let _data = { resId: "", @@ -227,21 +248,25 @@ return; } let _data = _json.data; - _that.goodsCloums = [{resName: '请选择商品'}] + _that.goodsCloums = [{ + resName: '请选择商品' + }] _that.goodsIndex = 0; _that.goods = ''; _that.amount = ''; - if(_data.length < 1){ + if (_data.length < 1) { return; } _that.goodsCloums = _that.goodsCloums.concat(_data); }); }, - + // 父分类change - goodsParentTypeChange: function(e){ + goodsParentTypeChange: function(e) { // 清空二级分类 - this.goodsSonTypeCloums = [{name: '请选择商品类型'}]; + this.goodsSonTypeCloums = [{ + name: '请选择商品类型' + }]; this.goodsSonTypeIndex = 0; this.rstId = ''; //取其下标 @@ -251,17 +276,17 @@ return; } let selected = this.goodsTypeCloums[this.goodsTypeIndex] //获取选中的数组 - if(selected.rstId == 'custom'){ + if (selected.rstId == 'custom') { this.isCustom = true; return; - }else{ + } else { this.isCustom = false; } this.parentRstId = selected.rstId //选中的id this._loadSonGoodsTypes(); }, // 查询子分类 - _loadSonGoodsTypes: function(){ + _loadSonGoodsTypes: function() { let _that = this; let _data = { page: 1, @@ -278,7 +303,7 @@ }); }, // 子分类change - goodsTypeChange: function(e){ + goodsTypeChange: function(e) { this.goodsSonTypeIndex = e.target.value //取其下标 if (this.goodsSonTypeIndex == 0) { this.rstId = '' @@ -288,8 +313,8 @@ this.rstId = selected.rstId //选中的id this._loadRepairGoods(); }, - - goodsChange: function(e){ + + goodsChange: function(e) { this.goodsIndex = e.target.value //取其下标 if (this.goodsIndex == 0) { this.goods = '' @@ -297,17 +322,17 @@ } let selected = this.goodsCloums[this.goodsIndex] //获取选中的数组 this.goods = selected - if(selected.outLowPrice == selected.outHighPrice){ + if (selected.outLowPrice == selected.outHighPrice) { this.singlePrice = selected.outLowPrice; this.disabledPrice = true; - }else{ + } else { this.singlePrice = ''; this.disabledPrice = false; } }, - - numDec: function(){ - if(this.useNumber <= 1){ + + numDec: function() { + if (this.useNumber <= 1) { uni.showToast({ title: '不能再减少了', icon: 'none' @@ -316,34 +341,34 @@ } this.useNumber -= 1; }, - - numInc: function(){ + + numInc: function() { this.useNumber += 1; }, - - _save: function(){ + + _save: function() { // 验证必填项 let msg = ''; - if(this.isCustom){ - if(!this.customGoodsName){ + if (this.isCustom) { + if (!this.customGoodsName) { msg = '请输入商品名'; - }else if(this.feeFlag == '1001' && !this.singlePrice){ + } else if (this.feeFlag == '1001' && !this.singlePrice) { msg = '请输入有效金额'; } - }else{ - if(this.rstId == ''){ + } else { + if (this.rstId == '') { msg = "请选择商品类型"; - }else if (this.useNumber < 1){ + } else if (this.useNumber < 1) { msg = "商品数量不能为零"; - }else if (!this.goods){ + } else if (!this.goods) { msg = "请选择商品"; - }else if (this.feeFlag == '1001' && !this.singlePrice){ + } else if (this.feeFlag == '1001' && !this.singlePrice) { msg = "请输入有效金额"; } } - if(msg != ''){ + if (msg != '') { wx.showToast({ - title:msg, + title: msg, icon: 'none' }) return; @@ -353,15 +378,15 @@ chooseResource.useNumber = this.useNumber; chooseResource.isCustom = this.isCustom; chooseResource.customGoodsName = this.customGoodsName; - if(this.isCustom){ + if (this.isCustom) { chooseResource.goodsTypeName = '自定义'; } chooseResource = JSON.stringify(chooseResource); this.$emit('getResourceInfo', chooseResource) this.showModel = false; }, - - _canel: function(){ + + _canel: function() { this.showModel = false; } } @@ -369,7 +394,7 @@ + \ No newline at end of file