diff --git a/pages/demand-center/accept-demand-center.vue b/pages/demand-center/accept-demand-center.vue index de30170..820d168 100644 --- a/pages/demand-center/accept-demand-center.vue +++ b/pages/demand-center/accept-demand-center.vue @@ -10,7 +10,7 @@ - @@ -22,27 +22,36 @@ :scroll-left="scrollLeft"> - - - {{item.title}} - - - - - {{item.title}} - - - - {{item.title}} - - - + + + + + {{chosenArea && chosenArea.length ? chosenArea[2].areaName : item.title}} + + + + + + + + + {{chosenCategory && chosenCategory.length ? chosenCategory[2].goodsCategoryName : item.title}} + + + + + + {{item.title}} + + + - - + + @@ -188,40 +197,73 @@ pageNum: 0, pageSize: 0, // type: 0=升降序,1=功能按钮;order: 0=升序,1=降序; - taskConditions: [{ - code: 'area', - title: '区域' - }, { - code: 'category', - title: '品类' - }, { - code: 'distance', - title: '距离', - type: 0, - value: 0, - }, { - code: 'time', - title: '时间', - type: 0, - value: 0, - }, { - code: 'reset', - type: 1, - title: '重置' + taskConditions: [{ + code: 'countryId', + title: '区域', + type: 2 + }, { + code: 'goodsCategoryId', + title: '品类', + type: 2 + }, + // { + // code: 'distance', + // title: '距离', + // type: 0, + // value: 0, + // }, + { + code: 'createTimeSort', + title: '时间', + type: 0, + value: 1, + }, { + code: 'reset', + type: 1, + title: '重置', + action: 'resetConditions' }], - searchInputVal: '', + originTaskConditions: [{ + code: 'countryId', + title: '区域', + type: 2 + }, { + code: 'goodsCategoryId', + title: '品类', + type: 2 + }, + // { + // code: 'distance', + // title: '距离', + // type: 0, + // value: 0, + // }, + { + code: 'createTimeSort', + title: '时间', + type: 0, + value: 1, + }, { + code: 'reset', + type: 1, + title: '重置', + action: 'resetConditions' + }], tasks: [], curTask: null, takeCertify: false, showAddPriceModal: false, showForwardModal: false, showTakeCertifiedModal: false, - showTakeSuccessModal: false, - areaList: [], - areaMultiIndex: [0, 0, 0], - categoryList: [], + showTakeSuccessModal: false, + curUserInfo: {}, + inputGoodsName: null, + areaList: [], + areaMultiIndex: [0, 0, 0], + chosenArea: [], + categoryList: [], categoryMultiIndex: [0, 0, 0], - curUserInfo: {} + chosenCategory: [] } }, onShow() { @@ -232,15 +274,26 @@ // this.tasks = await this.$api.data('tasks'); this.curUserInfo = this.$request.getCurUserInfo(); this.reloadMasterOrderPage(); - this.takeCertify = await this.$api.data('takeCertify'); - this.areaList = await this.$api.data('areaList'); - this.categoryList = await this.$api.data('categoryList'); + // this.takeCertify = await this.$api.data('takeCertify'); + // this.areaList = await this.$api.data('areaList'); + // this.categoryList = await this.$api.data('categoryList'); + this.loadCategoryList(); + this.loadRegionList(); }, async loadMasterOrderPage(params = {}) { params.pageSize = this.$globalData.initPageSize; params.pageNum = this.pageNum; params.orderStatus = 0; params.workerId = -1; + params.goodsName = this.inputGoodsName; + this.taskConditions.forEach((condition) => { + if (condition.type === 2) { + params[condition.code] = condition.value; + } else if (condition.type === 0) { + params.params = params.params ? params.params : {}; + params.params[condition.code] = condition.value === 1 ? 'desc' : 'asc'; + } + }) this.$refs.loadStatusBar.showLoading(); try { @@ -271,41 +324,144 @@ this.$refs.loadStatusBar.showLoadMore(); this.loadMasterOrderPage(params); }, - tabSelect(e) { - this.tabCur = e.currentTarget.dataset.id; - this.scrollLeft = (e.currentTarget.dataset.id - 1) * 70; - let conditionType = this.taskConditions[this.tabCur].type; - let conditionCode = this.taskConditions[this.tabCur].code; - if (conditionType === 0) { - // 升降序类型的条件切换升降序 - let orderVal = this.taskConditions[this.tabCur].value; - this.taskConditions[this.tabCur].value = orderVal === 0 ? 1 : 0; + tabSelect(e) { + this.tabCur = e.currentTarget.dataset.id; + this.scrollLeft = (e.currentTarget.dataset.id - 1) * 70; + let conditionType = this.taskConditions[this.tabCur].type; + let conditionCode = this.taskConditions[this.tabCur].code; + if (conditionType === 0) { + // 升降序类型的条件切换升降序 + let orderVal = this.taskConditions[this.tabCur].value; + this.taskConditions[this.tabCur].value = orderVal === 0 ? 1 : 0; + this.searchTasks(); + } + }, + barBtnClick(index) { + this[this.taskConditions[index].action](); + }, + async loadCategoryList(idArr) { + let typeList = await this.$request.listByStep(); + typeList = typeList.data; + let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId; + let subTypeList = await this.$request.listByStep({ + goodsCategoryId: col1Id + }); + subTypeList = subTypeList.data; + let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId; + let subSubTypeList = await this.$request.listByStep({ + goodsCategoryId: col2Id + }); + subSubTypeList = subSubTypeList.data; + this.categoryList.push(typeList); + this.categoryList.push(subTypeList); + this.categoryList.push(subSubTypeList); + }, + async loadRegionList() { + let regionList = await this.$request.areaListByStep(); + regionList = regionList.data; + let subRegionList = []; + let subSubRegionList = []; + if (regionList && regionList.length > 0) { + subRegionList = await this.$request.areaListByStep({ + parentCode: regionList[0].areaCode + }); + subRegionList = subRegionList.data; } - this.searchTasks(); + if (subRegionList && subRegionList.length > 0) { + subSubRegionList = await this.$request.areaListByStep({ + parentCode: subRegionList[0].areaCode + }); + subSubRegionList = subSubRegionList.data; + } + this.areaList.push(regionList); + this.areaList.push(subRegionList); + this.areaList.push(subSubRegionList); }, searchTasks() { - let qryObj = {}; - this.taskConditions.forEach((condition) => { - qryObj[condition.code] = condition.value; - }) - qryObj.name = this.searchInputVal; - //TODO: 调用查询tasks的接口 + this.reloadMasterOrderPage(); + }, + resetConditions() { + this.inputGoodsName = null; + for(let i = 0; i < this.originTaskConditions.length; i++) { + this.taskConditions[i].value = this.originTaskConditions[i].value; + } + this.chosenArea = []; + this.chosenCategory = []; + // this.$forceUpdate(); + this.reloadMasterOrderPage(); }, - regionChange(e) { - this.areaMultiIndex = e.detail.value; - let chosenArea = []; - for (let i = 0; i < this.areaList.length; i++) { - chosenArea.push(this.areaList[i][this.areaMultiIndex[i]]); - } - this.taskConditions[this.tabCur].value = chosenArea; + regionChange(e) { + this.areaMultiIndex = e.detail.value; + let chosenArea = []; + for (let i = 0; i < this.areaList.length; i++) { + chosenArea.push(this.areaList[i][this.areaMultiIndex[i]]); + } + this.chosenArea = chosenArea; + this.taskConditions[this.tabCur].value = chosenArea[chosenArea.length - 1].areaId; + this.searchTasks(); + }, + async regionColChange(e) { + let colObj = e.detail; + if (colObj.column == 0) { + // 通过一级查二级 + let subAreaList = await this.$request.areaListByStep({parentCode: this.areaList[0][colObj.value].areaCode}); + subAreaList = subAreaList.data; + let subSubAreaList = []; + if (subAreaList.length) { + subSubAreaList = await this.$request.areaListByStep({parentCode: subAreaList[0].areaCode}); + subSubAreaList = subSubAreaList.data; + } + this.areaList.pop(); + this.areaList.pop(); + this.areaList.push(subAreaList); + this.areaList.push(subSubAreaList); + this.areaMultiIndex = [colObj.value, 0, 0]; + } else if (colObj.column == 1) { + // 通过二级查三级 + let subAreaList = await this.$request.areaListByStep({parentCode: this.areaList[1][colObj.value].areaCode}); + subAreaList = subAreaList.data; + this.areaList.pop(); + this.areaList.push(subAreaList); + this.areaMultiIndex = [this.areaMultiIndex[0], colObj.value, 0]; + } }, - categoryChange(e) { - this.categoryMultiIndex = e.detail.value; - let chosenCategory = []; - for (let i = 0; i < this.categoryList.length; i++) { - chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[i]]); - } - this.taskConditions[this.tabCur].value = chosenCategory; + async categoryChange(e) { + this.categoryMultiIndex = e.detail.value; + let chosenCategory = []; + for (let i = 0; i < this.categoryList.length; i++) { + chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[i]]); + } + this.chosenCategory = chosenCategory; + this.taskConditions[this.tabCur].value = chosenCategory[chosenCategory.length - 1].goodsCategoryId; + this.searchTasks(); + }, + async categoryColChange(e) { + let colObj = e.detail; + if (colObj.column == 0) { + // 通过一级查询二级 + let subTypeList = await this.$request.listByStep({ + goodsCategoryId: this.categoryList[0][colObj.value].goodsCategoryId + }); + subTypeList = subTypeList.data; + let subSubTypeList = await this.$request.listByStep({ + goodsCategoryId: subTypeList[0].goodsCategoryId + }); + subSubTypeList = subSubTypeList.data; + this.categoryList.pop(); + this.categoryList.pop(); + this.categoryList.push(subTypeList); + this.categoryList.push(subSubTypeList); + this.categoryMultiIndex = [colObj.value, 0, 0]; + } else if (colObj.column == 1) { + // 通过二级查三级 + let subSubTypeList = await this.$request.listByStep({ + goodsCategoryId: this.categoryList[1][colObj.value].goodsCategoryId + }); + subSubTypeList = subSubTypeList.data; + this.categoryList.pop(); + this.categoryList.push(subSubTypeList); + this.categoryMultiIndex = [this.categoryMultiIndex[0], colObj.value, 0]; + } }, showDemandDetail(e, task) { let paramObj = { @@ -355,6 +511,17 @@ } - diff --git a/pages/order-manage/order-manage.vue b/pages/order-manage/order-manage.vue index 3323cc0..dc41ac2 100644 --- a/pages/order-manage/order-manage.vue +++ b/pages/order-manage/order-manage.vue @@ -379,6 +379,9 @@ // params.orderStatus = this.subStateList[this.tabCur].code; // params.pageNum = this.pageParams[this.tabCur].pageNum; params.pageNum = this.pageNum; + params.goodsName = this.formData.orderKeywords; + params.countryId = this.formData.area && this.formData.area.length > 2 ? this.formData.area[2].areaId : null; + params.goodsCategoryId = this.formData.category && this.formData.category.length > 2 ? this.formData.category[2].goodsCategoryId : null; if (this.tabCur != null) { params.orderStatus = this.subStateList[this.tabCur].code; } else if (this.stateCur != null) { @@ -532,9 +535,8 @@ } this.formData.category = chosenCategory; }, - searchOrder(e) { - console.log(e) - console.log(this.formData) + searchOrder() { + this.reloadMasterOrderPage(); }, resetConditions() { this.formData = {