From a1a7c2aed860d1a1bb1ac377a69cdeacb7609cb9 Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期五, 11 十月 2024 09:16:42 +0800 Subject: [PATCH] - --- src/pages/order/detail.vue | 368 +++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 304 insertions(+), 64 deletions(-) diff --git a/src/pages/order/detail.vue b/src/pages/order/detail.vue index 2b30a1a..bcc2de9 100644 --- a/src/pages/order/detail.vue +++ b/src/pages/order/detail.vue @@ -1,59 +1,117 @@ <template> <view class=""> <scroll-view enable-flex="true"> - <view class="list chuany-flex chuany-flex-direction chuany-align-center c-p-b-30"> - <view class="content " v-for="(item,index) in list2" @click='toDetail' :key='item.id'> - <view class="bgblue c-p-18 chuany-flex chuany-justify-between chuany-font34 chuany-text-bold"> - <text class=''> - {{item.time}} - </text> - <text> - 鎷泏{item.zhaodao}}/{{item.peoplenum}}浜� - </text> - </view> - <view class="c-p-18 chuany-font44 chuany-text-bold"> - {{item.name}} - </view> - <view class="chuany-flex c-p-l-18"> - <up-tag class='c-p-r-14' :text="item" plain v-for="(item,index) in item.tags" :key="index"> - </up-tag> - </view> - <view class="chuany-flex chuany-flex-direction"> - <text class='c-p-18'> - 瑕佹眰锛歿{item.yaoqiu}} - </text> - <text class='c-p-l-18 c-p-b-16'> - 鍦板潃锛歿{item.adress}} - </text> - </view> - <view class='chuany-flex chuany-justify-between c-p-l-18 c-p-r-18'> - <view class="redcla"> - <text class="chuany-font40 chuany-text-bold"> - {{item.price}} - </text> - <text class='chuany-font20'> - 鍏�/灏忔椂 + <view class="list chuany-flex chuany-flex-direction chuany-align-center c-p-b-30" @click='toEdit'> + <view class="content c-p-b-18"> + <view + class="bgblue c-p-l-18 c-p-r-18 c-p-b-10 c-p-t-10 chuany-flex chuany-justify-between chuany-font30"> + <view class="chuany-flex chuany-flex-direction"> + <text class=''> + {{$util.formatDate(detailItem.startTime)}} </text> </view> - <!-- <up-tag text="鍘绘姠娲�" type="warning" shape="circle"></up-tag> --> - <!-- <up-tag text="鍘绘姠娲�" type="warning" shape="circle"></up-tag> --> + <text> + 鎷泏{detailItem.worderCounted}}/{{detailItem.worderCount}}浜� + </text> + </view> + <view class="c-p-l-18 c-p-t-5 c-p-r-18 chuany-font32"> + {{detailItem.orderName}} + </view> + <!-- <view class="chuany-flex c-p-l-18"> + <up-tag class='c-p-r-14' :text="item" plain v-for="(item,index) in item.tags" :key="index"> + </up-tag> + </view> --> + <view class="chuany-flex chuany-flex-direction chuany-font28"> + <text class='c-p-l-18 c-p-r-18 text-69'> + 鏃ユ湡锛歿{detailItem.wordStartTimeName}} 鑷� {{detailItem.wordEndTimeName}} + </text> + <view class="c-p-l-18 c-p-r-18 text-69" v-if="detailItem.zixinganpai"> + 鏃堕棿锛歿{detailItem.zixinganpaiName}} + </view> + <view class="c-p-l-18 c-p-r-18 text-69" v-else> + 鏃堕棿锛歿{detailItem.startTimeName}} 鑷� {{detailItem.endTimeName}} + </view> + </view> + <view class="chuany-flex chuany-flex-direction chuany-font28"> + <text class='c-p-l-18 c-p-r-18 text-69'> + 瑕佹眰锛歿{detailItem.demand}} + </text> + <text class='c-p-l-18 c-p-r-18 text-69'> + 鍦板潃锛歿{detailItem.worderAddress}} + </text> + </view> + <view class='chuany-flex chuany-justify-between c-p-l-18 c-p-r-18 c-p-t-6 chuany-align-center'> + <view class="redcla"> + <text class="chuany-font40"> + {{detailItem.workPrice}}<template + v-if="detailItem.workPriceMax">~{{detailItem.workPriceMax}}</template> + </text> + <text class='chuany-font20'> + {{detailItem.workerType==0?'鍏�/灏忔椂':'鍏�/浠�'}} + </text> + <!-- <text class="chuany-font40"> + {{detailItem.workPrice}} + </text> + <text class='chuany-font20'> + {{detailItem.workerType==0?'鍏�/灏忔椂':'鍏�/浠�'}} + </text> --> + </view> + <view class="" @click.stop="manageOrder(detailItem)"> + <!-- <up-tag class='c-m-r-10' text="涓嬫灦" shape="circle" type="error" size='mini' + v-if="detailItem.orderStatus==0" @click.stop="deleteOrder(detailItem)"></up-tag> --> + <up-button class='c-m-r-10' :text="detailItem.isEn?'涓嬫灦':'涓婃灦'" shape="circle" + :loading='isLoading' :loadingText="detailItem.isEn?'涓嬫灦涓�':'涓婃灦涓�'" + v-if="detailItem.orderStatus==0" :type="detailItem.isEn?'error':'primary'" + size='mini'></up-button> + <!-- <up-tag text="鍘绘姠娲�" type="warning" shape="circle"></up-tag> --> + <!-- <up-tag text="鍘绘姠娲�" type="warning" shape="circle"></up-tag> --> + </view> </view> </view> </view> - <view class="coreshop-ff"> - <up-list> - <up-list-item> - <up-cell title="鍛ㄥ厛鐢�"> + <view class="coreshop-ff" v-if="detailItem.orderBidding"> + <up-list v-if="detailItem.orderBidding.length>0"> + <up-list-item v-for="(item,index) in detailItem.orderBidding" :key="item.id" + @click.stop="toWorkDetail"> + <up-cell :title="item.workerName" :border='false'> <template #icon> - <up-avatar shape="square" size="35" src="https://uview-plus.jiangruyi.com/album/1.jpg" - customStyle="margin: -3px 5px -3px 0"></up-avatar> + <up-avatar shape="square" size="35" :src="item.workerAvatar" + @click='toWorkerDetail(item)' customStyle="margin: -3px 5px -3px 0"></up-avatar> </template> - <template #right-icon> - <up-button class="button-layout__item" text="鏌ョ湅" size="mini" type="primary"></up-button> + <!-- <template #right-icon v-if="item.isSelected"> + <up-button class="button-layout__item" text="鏌ョ湅" size="mini" type="primary" @click="toView(item)"></up-button> + </template> --> + <template #right-icon v-if="!item.isSelected" class="chuany-flex"> + <up-tag class="button-layout__item" text="褰曠敤" size="mini" type="success" + @click="selectBtn(item,true)"></up-tag> + <up-tag class="button-layout__item c-m-l-18" text="鎷掔粷" size="mini" type="error" + @click="selectBtn(item,false)"></up-tag> + </template> + <template #right-icon v-else class="chuany-flex"> + <template class="" v-if="item.workPrice&&!item.showEdit"> + <up-text type="error" + :text="item.workerType==0?`${item.workPrice}鍏�/灏忔椂`:`${item.workPrice}鍏�/浠禶 " + size='14'></up-text> + <up-icon name="edit-pen" @click='isShow(item)'></up-icon> + </template> + <up-input v-model="item.workPrice" border="none" v-else type="digit"> + <template #suffix> + <up-button @tap="saveWorkPrice(item)" text="淇濆瓨" type="success" + form-type="submit" size="mini"></up-button> + </template> + <!-- <template #suffix v-else> + <up-icon name="edit-pen" @click='isShow'></up-icon> + </template> --> + </up-input> + <!-- <up-text type="error" v-else text="宸叉嫆缁�" size='14'></up-text> --> + <!-- <up-tag class="button-layout__item" text="褰曠敤" size="mini" type="success" + @click="selectBtn(item,true)"></up-tag> + <up-tag class="button-layout__item c-m-l-18" text="鎷掔粷" size="mini" type="error" + @click="selectBtn(item,false)"></up-tag> --> </template> </up-cell> </up-list-item> - <up-list-item> + <!-- <up-list-item> <up-cell title="鏉庡厛鐢�"> <template #icon> <up-avatar shape="square" size="35" src="https://uview-plus.jiangruyi.com/album/2.jpg" @@ -74,43 +132,221 @@ <up-button class="button-layout__item" text="纭" size="mini" type="success"></up-button> </template> </up-cell> + </up-list-item> --> + </up-list> + <up-list v-else> + <up-list-item> + <up-cell title="鏆傛棤鎶曢��" class="u-cell__title-text_wu" :border='false'> + <!-- <template #icon> + <up-avatar shape="square" size="35" src="https://uview-plus.jiangruyi.com/album/1.jpg" + customStyle="margin: -3px 5px -3px 0"></up-avatar> + </template> + <template #right-icon> + <up-button class="button-layout__item" text="鏌ョ湅" size="mini" type="primary"></up-button> + </template> --> + </up-cell> </up-list-item> </up-list> </view> </scroll-view> - + <up-modal :show="modalShow" :asyncClose="true" showCancelButton closeOnClickOverlay :content="content" + @confirm="modalConfirm" @cancel="modalCancel"> + </up-modal> </view> </template> <script setup> import { + onLoad, + onShow, + onReachBottom + } from "@dcloudio/uni-app"; + import { reactive, - ref + ref, + getCurrentInstance } from 'vue'; - let state = reactive({ - currentIdex: 0 + const { + $upload, + $api, + $util, + $db + } = getCurrentInstance().appContext.config.globalProperties + const detailItem = ref({}) + const workerItem = ref({}) + let selectVal = ref(false) + let orderIdVal = ref('') + let isLoading = ref(false) + let showEdit = ref(false) + onLoad((option) => { + let { + orderid + } = option + orderIdVal = orderid + // detailItem.value = JSON.parse($db.get('detailItem')) }) - - const list2 = reactive([{ - id: 1, - time: '鏄庡ぉ 19:00-23:00', - name: '涓存椂宸�', - tags: ['4灏忔椂', '鍙棤缁忛獙', '鎵嬭剼楹诲埄'], - adress: '姝︿警鍖烘婧閬�4.0km', - yaoqiu: '涓嶉檺', - price: 50, - peoplenum: 3, - zhaodao: 1 - }]); + onShow(() => { + getOrder(orderIdVal) + }) const click = () => { } - const change = (e) => { - state.currentIdex = e.index + const isShow = (item) => { + item.showEdit = true } - const toDetail = (e) => { + const saveWorkPrice = (item) => { + let obj = { + orderBiddingId: item.id, + workPrice: item.workPrice + } + console.log(item, obj); + if (!item.workPrice) { + $util.showToast({ + title: "璇疯緭鍏ュ伐浠凤紒", + icon: "success" + }) + return + } + $api.saveWorkPrice(obj).then(res => { + if (res.code == 1) { + $util.showToast({ + title: "宸ヤ环淇濆瓨鎴愬姛锛�", + icon: "success" + }) + getOrder(orderIdVal, item.id) + item.showEdit = false + } else { + $util.showToast({ + title: res.error + }) + } + }) + } + let modalShow = ref(false) + let content = ref('') + const toView = (item) => { uni.navigateTo({ - url: '/pages/detail/detail' + url: `/pages/company/index?workerid=${item.WorkerUserId}&workname=${item.WorkerName}` + }) + } + const toWorkerDetail = (item) => { + $db.set('toudiItem', item) + uni.navigateTo({ + url: `/pages/worker/worker?workerid=${item.workerUserId}` + }) + } + const toWorkDetail = (e) => { + uni.navigateTo({ + url: '/pages/order/worker' + }) + } + const selectBtn = (item, val) => { + workerItem.value = item + modalShow.value = true + selectVal.value = val + if (val) { + content.value = `纭畾褰曠敤${item.workerName}鍚楋紵` + } else { + content.value = `纭畾鎷掔粷${item.workerName}鍚楋紵` + } + } + const modalConfirm = () => { + if (selectVal.value) { + console.log('3333333333'); + $api.saveQueRen({ + orderBiddingId: workerItem.value.id + }).then(res => { + if (res.code == 1) { + $util.showToast({ + title: "褰曠敤鎴愬姛锛�", + icon: "success" + }) + getOrder(orderIdVal) + } else { + $util.showToast({ + title: res.error ? res.error : '澶辫触锛�' + }) + } + modalShow.value = false + }) + + } else { + console.log('444444'); + $api.saveBuLuYong({ + orderBiddingId: workerItem.value.id + }).then(res => { + if (res.code == 1) { + $util.showToast({ + title: "鎷掔粷鎴愬姛锛�", + icon: "success" + }) + getOrder(orderIdVal) + } else { + $util.showToast({ + title: res.error ? res.error : '澶辫触锛�' + }) + } + modalShow.value = false + }) + } + } + const modalCancel = () => { + modalShow.value = false + workerItem.value = {} + } + const getOrder = (orderid, id) => { + $api.getOrder(orderid).then(res => { + if (res.code == 1) { + res.data.orderBidding.forEach(item => { + item.showEdit = false + if (id == item.id) { + toWorkerDetail(item) + } + }) + detailItem.value = res.data + } + }) + } + const manageOrder = (item) => { + let obj = { + orderId: item.id + } + isLoading.value = true + if (item.isEn) { + $api.deleteOrder(obj).then(res => { + if (res.code == 1) { + $util.showToast({ + title: '涓嬫灦鎴愬姛锛�' + }) + getOrder(orderIdVal) + } else { + $util.showToast({ + title: res.error + }) + } + isLoading.value = false + }) + } else { + $api.saveOrder(item).then(res => { + if (res.code == 1) { + $util.showToast({ + title: "涓婃灦鎴愬姛锛�", + icon: "success" + }) + getOrder(orderIdVal) + } else { + $util.showToast({ + title: res.msg + }) + } + isLoading.value = false + }) + } + } + const toEdit = () => { + $db.set('editItem', detailItem.value) + uni.navigateTo({ + url: `/pages/release/index` }) } </script> @@ -122,7 +358,7 @@ } .content { - height: 430rpx; + min-height: 200rpx; width: 100%; background-color: #fff; border-radius: 20rpx; @@ -139,4 +375,8 @@ .redcla { color: #f05348; } + + .u-cell__title-text_wu { + text-align: center; + } </style> \ No newline at end of file -- Gitblit v1.9.1