diff --git a/components/applyCard.vue b/components/applyCard.vue index 74c4d91..c6f2404 100644 --- a/components/applyCard.vue +++ b/components/applyCard.vue @@ -1,21 +1,20 @@ @@ -103,7 +109,7 @@ export default { font-size: 30rpx; color: #333333; margin-left: 5px; - } + } .desc{ font-size: 28rpx; color: #858BA0 diff --git a/pages-order/choosePeople/choosePeople.vue b/pages-order/choosePeople/choosePeople.vue index 4b4940a..510b266 100644 --- a/pages-order/choosePeople/choosePeople.vue +++ b/pages-order/choosePeople/choosePeople.vue @@ -148,7 +148,12 @@ export default { }).then(res => { this.list = res.data.records this.list.map((item) => { - item.workTypeText = getDictTextByCodeAndValue('repair_work_type', item.workType) + getDictTextByCodeAndValue("repair_work_type",item.workType).then(value => { + item.workTypeText = value + }).catch(error => { + item.workTypeText = "未知" + console.error(error); + }); }) }) }, @@ -163,7 +168,12 @@ export default { }).then((res) => { this.list = res.data this.list.map((item) => { - item.workTypeText = getDictTextByCodeAndValue('repair_work_type', item.workType) + getDictTextByCodeAndValue("repair_work_type",item.workType).then(value => { + item.workTypeText = value + }).catch(error => { + item.workTypeText = "未知" + console.error(error); + }); }) if (this.list.length > 0) { console.log(this.list[0].userId) diff --git a/pages-order/orderDetail/orderDetail.vue b/pages-order/orderDetail/orderDetail.vue index 20ddbbc..8caa2d1 100644 --- a/pages-order/orderDetail/orderDetail.vue +++ b/pages-order/orderDetail/orderDetail.vue @@ -185,7 +185,7 @@ 售价:{{ item.itemPrice || "" }} 数量:{{ item.itemCount || "" }} - 单位:{{ getItemUnit(item.itemUnit) || ""}} + 单位:{{ item.itemUnit || ""}} 折扣:{{ item.itemDiscount || "" }} 金额:{{ item.itemMoney || "" }} @@ -633,10 +633,26 @@ export default { //维修记录匹配数据字典 if (null != resultObj.records){ resultObj.records.map((item)=>{ - item.typeStr = getDictTextByCodeAndValue('repair_records_type',item.type) + getDictTextByCodeAndValue("repair_records_type",item.type).then(value => { + item.typeStr = value + }).catch(error => { + item.typeStr = "未知" + console.error(error); + }); item.createTime = formatTimestamp(item.createTime) }) } + //配件翻译字典 + if (null != resultObj.wares){ + resultObj.wares.map((item)=>{ + getDictTextByCodeAndValue("repair_unit",item.itemUnit).then(value => { + item.itemUnit = value + }).catch(error => { + item.itemUnit = "未知" + console.error(error); + }); + }) + } this.ticketInfo = resultObj //判断当前角色及工单状态显示操作按钮 this.checkRoleOperate() @@ -697,10 +713,6 @@ export default { // url: `/pages-order/choosePeople/choosePeople?type=${type}&id=${this.ticketId}` }) }, - //翻译配件单位 - getItemUnit(unitCode){ - return getDictTextByCodeAndValue("repair_unit",unitCode); - }, /** * 点击配件申请单提醒,查看相关配件 * @param wareId diff --git a/pages-repair/apply/applyForm.vue b/pages-repair/apply/applyForm.vue index 1e78684..50cbd48 100644 --- a/pages-repair/apply/applyForm.vue +++ b/pages-repair/apply/applyForm.vue @@ -20,7 +20,7 @@ {{ item.name }} 单位: - {{ getItemUnit(item.unit) }} + {{ item.unit }} @@ -175,6 +175,13 @@ export default { }else{ m.num = 0 } + //翻译单位 + getDictTextByCodeAndValue("repair_unit",m.unit).then(value => { + m.unit = value + }).catch(error => { + m.unit = "未知" + console.error(error); + }); return m }) //判断 如果获取的数据的页码不是第一页,就让之前赋值获取过的数组数据 concat连接 刚获取的第n页数据 @@ -269,10 +276,6 @@ export default { this.activeId = value this.onRefresherrefresh() }, - //翻译配件单位 - getItemUnit(unitCode){ - return getDictTextByCodeAndValue("repair_unit",unitCode); - }, } } diff --git a/pages-repair/applyList/applyList.vue b/pages-repair/applyList/applyList.vue index ca4059f..4fb155b 100644 --- a/pages-repair/applyList/applyList.vue +++ b/pages-repair/applyList/applyList.vue @@ -12,7 +12,7 @@ - + @@ -27,6 +27,7 @@ import tabBarVue from '@/components/tabBar/tabBar.vue' import OrderCard from "@/components/applyCard.vue"; import request from '@/utils/request'; + import {getUserInfo} from '@/utils/auth'; export default { components: { OrderCard, @@ -52,39 +53,60 @@ }, { id: 2, - title: '已通过' + title: '待领料' + }, + { + id: 3, + title: '待退料' }, ], orderList: [ - { - carNo: "川E795C0", - createTime: '2024-10-20 12:00', - ticketsStatus: '05', - remark: '大厦预订奴化时间内丢进爱上牛津阿斯顿你' - }, - { - carNo: "川E795C1", - createTime: '2024-10-20 12:00', - ticketsStatus: '02', - remark: '大厦预订奴化时间内丢进爱上牛津阿斯顿你' - }, - { - carNo: "川E795C2", - createTime: '2024-10-20 12:00', - ticketsStatus: '01', - remark: '大厦预订奴化时间内丢进爱上牛津阿斯顿你' - } + // { + // carNo: "川E795C0", + // createTime: '2024-10-20 12:00', + // ticketsStatus: '05', + // remark: '大厦预订奴化时间内丢进爱上牛津阿斯顿你' + // }, + // { + // carNo: "川E795C1", + // createTime: '2024-10-20 12:00', + // ticketsStatus: '02', + // remark: '大厦预订奴化时间内丢进爱上牛津阿斯顿你' + // }, + // { + // carNo: "川E795C2", + // createTime: '2024-10-20 12:00', + // ticketsStatus: '01', + // remark: '大厦预订奴化时间内丢进爱上牛津阿斯顿你' + // } ], + userInfo:null, }; }, onLoad(){ - + this.userInfo = getUserInfo() + console.log(this.userInfo) + this.getOrderList() }, methods:{ changeTabFun(id) { this.activeKey = id this.onRefresherrefresh() }, + /** + * 上滑加载数据 + */ + onReachBottomCus() { + //判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕 + if (this.pageNo * this.pageSize >= this.total) { + uni.$u.toast('没有更多数据了') + return + } + //页码+1,调用获取数据的方法获取第二页数据 + this.pageNo++ + //此处调用自己获取数据列表的方法 + this.getOrderList() + }, /** * 下拉刷新数据 */ @@ -92,11 +114,74 @@ this.isTriggered = true this.pageNo = 1 this.total = 0 - //this.orderList = [] + this.orderList = [] this.getOrderList() }, + /** + * 查看申请单详情 + */ + viewDetail(item){ + if(0==this.activeKey || 1==this.activeKey){ + //配件申请单详情 + uni.navigateTo({ + url: '/pages-repair/applyList/todoDetail?viewType=apply&id='+item.id + }) + }else{ + //领料单\退料单详情 + uni.navigateTo({ + url: '/pages-repair/applyList/todoDetail?viewType=receive&id='+item.id + }) + } + }, + /** + * 查数据 + */ getOrderList(){ - + let url="" + let params = { + pageNo:this.pageNo, + pageSize:this.pageSize + } + if(0==this.activeKey){ + //已提交的配件申请单 + url = "/admin-api/repair/tw/page" + params.type="01" + }else if(1==this.activeKey){ + //未通过的配件申请单 + url = "/admin-api/repair/tw/page" + params.type="01" + params.status="05" + }else if(2==this.activeKey){ + //待确认的领料单 + url = "/admin-api/repair/so/page" + params.soType = "02" + params.userId = this.userInfo.id + params.soStatus = "04" + }else if(3==this.activeKey){ + //待确认的退料单 + url = "/admin-api/repair/so/page" + params.soType = "04" + params.userId = this.userInfo.id + params.soStatus = "07" + } + request({ + url: url, + method: 'get', + params:params + }).then((res) => { + if (res.code == 200) { + if(res.data.records.length > 0){ + if (this.pageNo != 1) { + this.orderList = this.orderList.concat(res.data.records) + } else { + this.orderList = res.data.records + } + } + //将获取的总条数赋值 + this.total = res.data.total + this.isTriggered = false + } + }) } } } diff --git a/pages-repair/applyList/todoDetail.vue b/pages-repair/applyList/todoDetail.vue new file mode 100644 index 0000000..93c395c --- /dev/null +++ b/pages-repair/applyList/todoDetail.vue @@ -0,0 +1,246 @@ + + + + + diff --git a/pages-repair/static/daishenhe.png b/pages-repair/static/daishenhe.png new file mode 100644 index 0000000..086c3a7 Binary files /dev/null and b/pages-repair/static/daishenhe.png differ diff --git a/pages-repair/static/weitongguo.png b/pages-repair/static/weitongguo.png new file mode 100644 index 0000000..a0d62b9 Binary files /dev/null and b/pages-repair/static/weitongguo.png differ diff --git a/pages-repair/static/yitongguo.png b/pages-repair/static/yitongguo.png new file mode 100644 index 0000000..2bbaec3 Binary files /dev/null and b/pages-repair/static/yitongguo.png differ diff --git a/pages.json b/pages.json index 3b6038f..ecd4f7a 100644 --- a/pages.json +++ b/pages.json @@ -152,6 +152,13 @@ { "navigationBarTitleText" : "" } + }, + { + "path" : "applyList/todoDetail", + "style" : + { + "navigationBarTitleText" : "" + } } ] }, @@ -161,22 +168,19 @@ { "path": "home/home", "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": true + "navigationBarTitleText": "" } }, { "path": "inOutWarehouse/inOutWarehouse", "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false + "navigationBarTitleText": "" } }, { "path": "todoDetail/todoDetail", "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": true + "navigationBarTitleText": "" } } ] diff --git a/utils/utils.js b/utils/utils.js index d846d64..5c86839 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -126,31 +126,29 @@ export function saveTicketsRecords(id,ticketsWorkStatus,itemId,itemStatus,record * 翻译字典 * @param dictCode */ -export function getDictTextByCodeAndValue(dictCode,value){ +export async function getDictTextByCodeAndValue(dictCode, value) { let dictArray = getStorageWithExpiry(dictCode); - if(null==dictArray || undefined==dictArray){ - request({ + if (null == dictArray || undefined == dictArray) { + let res = await request({ url: '/admin-api/system/dict-data/type', method: 'get', - params:{type:dictCode} - }).then((res) => { - console.log(res) - if (res.code == 200) { - setStorageWithExpiry(dictCode,res.data,3600) - dictArray = res.data - let dictObj = dictArray.find(item=>item.value==value) - if(dictObj){ - return dictObj.label - }else{ - return "未知数据" - } - } + params: {type: dictCode} }) - }else{ - let dictObj = dictArray.find(item=>item.value==value) - if(dictObj){ + if (res.code == 200) { + setStorageWithExpiry(dictCode, res.data, 3600) + dictArray = res.data + let dictObj = dictArray.find(item => item.value == value) + if (dictObj) { + return dictObj.label + } else { + return "未知数据" + } + } + } else { + let dictObj = dictArray.find(item => item.value == value) + if (dictObj) { return dictObj.label - }else{ + } else { return "未知数据" } }