Commit 84666772084efcf07c245048bed2b9b14b300c20

Authored by guzijian
1 parent 6ed7080a

feat: 新增取消订单,双向评价。

garbage-removal/src/pages/home/clean/company-detail/index.vue
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 核准说明:以上为市容环境卫生主管部门核准信息 46 核准说明:以上为市容环境卫生主管部门核准信息
47 </view> 47 </view>
48 </view> 48 </view>
49 - <view class="company-content-server"> 49 + <view class="company-content-server" v-if="false">
50 <view class="company-content-server-title">企业服务承诺</view> 50 <view class="company-content-server-title">企业服务承诺</view>
51 <view class="company-content-server-detail"> 51 <view class="company-content-server-detail">
52 <view class="company-content-server-detail-info-item" v-for="(item, index) in serverData" :key="index"> 52 <view class="company-content-server-detail-info-item" v-for="(item, index) in serverData" :key="index">
garbage-removal/src/pages/home/clean/index.vue
@@ -60,8 +60,8 @@ @@ -60,8 +60,8 @@
60 <text style="color: red;">*</text>现场照片(最多上传10张) 60 <text style="color: red;">*</text>现场照片(最多上传10张)
61 </view> 61 </view>
62 <view class="company-clean-container-site-image-info-img"> 62 <view class="company-clean-container-site-image-info-img">
63 - <u-upload :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="3" multiple :maxCount="10"  
64 - :previewFullImage="true"></u-upload> 63 + <u-upload width="200" height="150" :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="3"
  64 + multiple :maxCount="10" :previewFullImage="true"></u-upload>
65 </view> 65 </view>
66 <view class="company-clean-container-site-image-info-input-remark"> 66 <view class="company-clean-container-site-image-info-input-remark">
67 填写备注 67 填写备注
garbage-removal/src/pages/order/detail/index.vue
@@ -34,8 +34,8 @@ @@ -34,8 +34,8 @@
34 <view class="order-detail-container-header-item"> 34 <view class="order-detail-container-header-item">
35 <text class="order-detail-container-header-title">现场图片:</text> 35 <text class="order-detail-container-header-title">现场图片:</text>
36 <view class="order-detail-container-header-content"> 36 <view class="order-detail-container-header-content">
37 - <u-upload :fileList="currentImages" name="3" multiple :maxCount="10" :previewFullImage="true"  
38 - :isReadOnly="true"></u-upload> 37 + <u-upload width="180" height="130" :fileList="currentImages" name="3" multiple :maxCount="10"
  38 + :previewFullImage="true" :isReadOnly="true"></u-upload>
39 </view> 39 </view>
40 </view> 40 </view>
41 <view class="order-detail-container-header-item"> 41 <view class="order-detail-container-header-item">
@@ -84,7 +84,8 @@ @@ -84,7 +84,8 @@
84 <text class="order-detail-container-header-title">联系电话:</text> 84 <text class="order-detail-container-header-title">联系电话:</text>
85 <view class="order-detail-container-header-content"> 85 <view class="order-detail-container-header-content">
86 {{ dataGram.garOrderContactTel }} 86 {{ dataGram.garOrderContactTel }}
87 - <u-icon name="phone" size="28" @click="handleContactClick(dataGram.garOrderContactTel)"></u-icon> 87 + <u-icon v-if="dataGram.handleFlag" name="phone" size="28"
  88 + @click="handleContactClick(dataGram.garOrderContactTel)"></u-icon>
88 </view> 89 </view>
89 </view> 90 </view>
90 <view class="order-detail-container-header-item"> 91 <view class="order-detail-container-header-item">
@@ -121,15 +122,15 @@ @@ -121,15 +122,15 @@
121 <view class="order-detail-container-header-item"> 122 <view class="order-detail-container-header-item">
122 <text class="order-detail-container-header-title">装车照片:</text> 123 <text class="order-detail-container-header-title">装车照片:</text>
123 <view class="order-detail-container-header-content"> 124 <view class="order-detail-container-header-content">
124 - <u-upload :fileList="putOnImages" name="3" multiple :maxCount="20" :previewFullImage="true"  
125 - :isReadOnly="true"></u-upload> 125 + <u-upload width="180" height="130" :fileList="putOnImages" name="3" multiple :maxCount="20"
  126 + :previewFullImage="true" :isReadOnly="true"></u-upload>
126 </view> 127 </view>
127 </view> 128 </view>
128 <view class="order-detail-container-header-item"> 129 <view class="order-detail-container-header-item">
129 <text class="order-detail-container-header-title">卸车照片:</text> 130 <text class="order-detail-container-header-title">卸车照片:</text>
130 <view class="order-detail-container-header-content"> 131 <view class="order-detail-container-header-content">
131 - <u-upload :fileList="putDownImages" name="3" multiple :maxCount="20" :previewFullImage="true"  
132 - :isReadOnly="true"></u-upload> 132 + <u-upload width="180" height="130" :fileList="putDownImages" name="3" multiple :maxCount="20"
  133 + :previewFullImage="true" :isReadOnly="true"></u-upload>
133 </view> 134 </view>
134 </view> 135 </view>
135 </view> 136 </view>
@@ -144,35 +145,46 @@ @@ -144,35 +145,46 @@
144 <!-- 占位符 --> 145 <!-- 占位符 -->
145 <view class="order-detail-bottom"> 146 <view class="order-detail-bottom">
146 <view class="order-detail-bottom-box"> 147 <view class="order-detail-bottom-box">
147 - <view class="order-detail-bottom-left">  
148 - <!-- <u-button @click="handleOderCancelClick(orderId)" shape="circle" color="#a9e08f" text="取消订单"></u-button> --> 148 + <view class=" order-detail-bottom-left">
  149 + <u-button v-if="dataGram.garOrderHandlerStatus === 0 && userType == '管理负责人'" @click="handleOderCancelClick()"
  150 + shape="circle" color="#a9e08f" text="取消订单"></u-button>
149 </view> 151 </view>
150 <view class="order-detail-bottom-right"> 152 <view class="order-detail-bottom-right">
  153 + <u-button v-if="dataGram.garOrderHandlerStatus === 0 && userType == '居民用户'" @click="handleOderCancelClick()"
  154 + shape="circle" color="#a9e08f" text="取消订单"></u-button>
151 <u-button @click="handleOrder(orderId)" 155 <u-button @click="handleOrder(orderId)"
152 - v-if="dataGram.garOrderHandlerStatus == 0 && dataGram.handleFlag && dataGram.garCancelFlag" shape="circle"  
153 - color="#a9e08f" text="处理派单"></u-button> 156 + v-if="dataGram.garOrderHandlerStatus === 0 && dataGram.handleFlag && dataGram.garCancelFlag === 0"
  157 + shape="circle" color="#a9e08f" text="处理派单"></u-button>
154 <u-button @click="handleUploadImage(orderId, 'putOnImages')" 158 <u-button @click="handleUploadImage(orderId, 'putOnImages')"
155 - v-if="dataGram.garOrderHandlerStatus === 1 && dataGram.putOnImages.length === 0 && dataGram.handleFlag && dataGram.garCancelFlag" 159 + v-if="dataGram.garOrderHandlerStatus === 1 && dataGram.putOnImages.length === 0 && dataGram.handleFlag && dataGram.garCancelFlag === 0"
156 shape="circle" color="#a9e08f" text="装车照片"></u-button> 160 shape="circle" color="#a9e08f" text="装车照片"></u-button>
157 <u-button @click="handleUploadImage(orderId, 'putDownImages')" 161 <u-button @click="handleUploadImage(orderId, 'putDownImages')"
158 - v-else-if="dataGram.garOrderHandlerStatus === 1 && dataGram.putDownImages.length === 0 && dataGram.handleFlag && dataGram.garCancelFlag" 162 + v-else-if="dataGram.garOrderHandlerStatus === 1 && dataGram.putDownImages.length === 0 && dataGram.handleFlag && dataGram.garCancelFlag === 0"
159 shape="circle" color="#a9e08f" text="卸车照片"></u-button> 163 shape="circle" color="#a9e08f" text="卸车照片"></u-button>
160 - <u-button @click="handleEvaluate(orderId)" v-if="dataGram.garEvaluateFlag == 0" shape="circle" color="#a9e08f"  
161 - text="去评价"></u-button> 164 + <u-button @click="handleEvaluate(orderId, userType)" v-if="dataGram.garEvaluateFlag === 0" shape="circle"
  165 + color="#a9e08f" text="去评价"></u-button>
  166 + <u-button @click="handleEvaluate(orderId, userType)" v-if="dataGram.garHandlerEvaluateFlag === 0" shape="circle"
  167 + color="#a9e08f" text="去评价"></u-button>
162 <u-button 168 <u-button
163 - v-if="dataGram.garOrderHandlerStatus == 1 && dataGram.putOnImages.length != 0 && dataGram.putDownImages.length != 0 && dataGram.garCancelFlag" 169 + v-if="dataGram.garOrderHandlerStatus === 1 && dataGram.putOnImages.length != 0 && dataGram.putDownImages.length != 0 && dataGram.garCancelFlag === 0"
164 @click="handleSubmitSuccess(orderId)" shape="circle" color="#a9e08f" text="完成派单"></u-button> 170 @click="handleSubmitSuccess(orderId)" shape="circle" color="#a9e08f" text="完成派单"></u-button>
165 </view> 171 </view>
166 </view> 172 </view>
167 </view> 173 </view>
  174 + <u-action-sheet :closeOnClickOverlay="true" :closeOnClickAction="false" @actionSheetClose="handleClose"
  175 + @submitFunction="submitFunction" @select="selectClick" :actions="list" round="15" title="取消派单" :show="cancelShow">
  176 + </u-action-sheet>
168 </view> 177 </view>
169 </template> 178 </template>
170 179
171 <script setup> 180 <script setup>
172 import { queryOrderDetail, updateOrder } from "@/apis/order.js"; 181 import { queryOrderDetail, updateOrder } from "@/apis/order.js";
173 import zStatic from '@/components/z-paging/js/z-paging-static'; 182 import zStatic from '@/components/z-paging/js/z-paging-static';
  183 +import { useMainStore } from '@/stores/index.js';
174 import { onLoad, onShow } from '@dcloudio/uni-app'; 184 import { onLoad, onShow } from '@dcloudio/uni-app';
175 -import { ref } from 'vue'; 185 +import { computed, ref } from 'vue';
  186 +const store = useMainStore();
  187 +const userType = computed(() => store.userType)
176 const dataGram = ref(); 188 const dataGram = ref();
177 const orderId = ref(null) 189 const orderId = ref(null)
178 const currentImages = ref([]) 190 const currentImages = ref([])
@@ -180,12 +192,40 @@ const putOnImages = ref([]) @@ -180,12 +192,40 @@ const putOnImages = ref([])
180 const putDownImages = ref([]) 192 const putDownImages = ref([])
181 const emptyBase64Image = ref(zStatic.base64Empty) 193 const emptyBase64Image = ref(zStatic.base64Empty)
182 const spaceStr = ref("") 194 const spaceStr = ref("")
  195 +const cancelShow = ref(false)
  196 +const currentCancelName = ref("")
  197 +const list = ref([
  198 + {
  199 + name: '长时间无人接单',
  200 + },
  201 + {
  202 + name: '订单信息填写有误',
  203 + },
  204 + {
  205 + name: '线下协商有问题',
  206 + },
  207 + {
  208 + name: '不需要清运了',
  209 + },
  210 + {
  211 + name: '其他',
  212 + },
  213 + {
  214 + name: '提交',
  215 + }
  216 +])
183 /** 217 /**
184 * 初始化信息 218 * 初始化信息
185 */ 219 */
186 onLoad((options) => { 220 onLoad((options) => {
187 orderId.value = options.orderId 221 orderId.value = options.orderId
188 }) 222 })
  223 +const handleClose = (e) => {
  224 + cancelShow.value = false
  225 +}
  226 +const selectClick = (index) => {
  227 + currentCancelName.value = index.name;
  228 +}
189 const handleOrderDetail = (orderId) => { 229 const handleOrderDetail = (orderId) => {
190 queryOrderDetail(orderId).then(res => { 230 queryOrderDetail(orderId).then(res => {
191 dataGram.value = res.data.data; 231 dataGram.value = res.data.data;
@@ -207,8 +247,50 @@ const handleContactClick = (val) =&gt; { @@ -207,8 +247,50 @@ const handleContactClick = (val) =&gt; {
207 uni.makePhoneCall({ phoneNumber: val }).then(res => { 247 uni.makePhoneCall({ phoneNumber: val }).then(res => {
208 }).catch(err => { }); 248 }).catch(err => { });
209 } 249 }
210 -const handleOderCancelClick = (orderId) => {  
211 250
  251 +/**
  252 + * 取消派单
  253 + * @param {*} orderId
  254 + */
  255 +const handleOderCancelClick = () => {
  256 + cancelShow.value = true;
  257 +}
  258 +
  259 +/**
  260 + * 提交取消订单
  261 + */
  262 +const submitFunction = (otherReason) => {
  263 + let reason = otherReason
  264 + if (currentCancelName.value != "其他") {
  265 + reason = currentCancelName.value
  266 + }
  267 + if (!reason) {
  268 + uni.$u.toast("请提供取消派单的原因")
  269 + return
  270 + }
  271 + let params = {
  272 + garOrderId: orderId.value,
  273 + garCancelFlag: 1,
  274 + garReason: reason
  275 + }
  276 + updateOrder(params).then(res => {
  277 + if (res.data.success) {
  278 + cancelShow.value = false
  279 + uni.$u.toast(res.data.data)
  280 + uni.$u.route({
  281 + type: "reLaunch",
  282 + url: `pages/order/index`,
  283 + })
  284 + }
  285 + })
  286 +}
  287 +const handleClick = (orderId) => {
  288 + uni.$u.route({
  289 + url: `pages/order/detail/index`,
  290 + params: {
  291 + orderId: orderId
  292 + }
  293 + })
212 } 294 }
213 // 提交完成 295 // 提交完成
214 const handleSubmitSuccess = (orderId) => { 296 const handleSubmitSuccess = (orderId) => {
@@ -228,17 +310,27 @@ const handleSubmitSuccess = (orderId) =&gt; { @@ -228,17 +310,27 @@ const handleSubmitSuccess = (orderId) =&gt; {
228 } 310 }
229 }); 311 });
230 } 312 }
231 -const handleEvaluate = (orderId) => [  
232 - uni.$u.route(`pages/order/evaluate/index?orderId=${orderId}`) 313 +const handleEvaluate = (orderId, userType) => [
  314 + uni.$u.route(`pages/order/evaluate/index?orderId=${orderId}&userType=${userType}`)
233 ] 315 ]
234 316
235 // 接收订单 317 // 接收订单
236 const handleOrder = (orderId) => { 318 const handleOrder = (orderId) => {
237 updateOrder({ garOrderId: orderId, handleType: 0 }).then(res => { 319 updateOrder({ garOrderId: orderId, handleType: 0 }).then(res => {
238 if (res.data.success) { 320 if (res.data.success) {
239 - uni.$u.toast(res.data.data)  
240 - handleOrderDetail(orderId) 321 + if (res.data.data === "订单已经被别人接受啦") {
  322 + uni.$u.toast(res.data.data)
  323 + uni.$u.route({
  324 + type: "reLaunch",
  325 + url: `pages/order/index`,
  326 + })
  327 + } else {
  328 + uni.$u.toast(res.data.data)
  329 + handleOrderDetail(orderId)
  330 + }
241 } 331 }
  332 +
  333 +
242 }) 334 })
243 } 335 }
244 336
garbage-removal/src/pages/order/evaluate/index.vue
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 </view> 9 </view>
10 <textarea v-if="textareaShow" @blur="blur" :value="textareaValue" :placeholder="textareaPlaceholder" /> 10 <textarea v-if="textareaShow" @blur="blur" :value="textareaValue" :placeholder="textareaPlaceholder" />
11 <view class="issue-btn-box"> 11 <view class="issue-btn-box">
12 - <button class="submit-btn" type="primary" @click="doSubmit(orderId, score, content)">提交评价</button> 12 + <button class="submit-btn" type="primary" @click="doSubmit(orderId, score, content, evaluateType)">提交评价</button>
13 </view> 13 </view>
14 </view> 14 </view>
15 </template> 15 </template>
@@ -21,12 +21,13 @@ import { ref } from &#39;vue&#39;; @@ -21,12 +21,13 @@ import { ref } from &#39;vue&#39;;
21 let maxScore = ref(5); 21 let maxScore = ref(5);
22 const orderId = ref() 22 const orderId = ref()
23 const maxStar = ref([]) 23 const maxStar = ref([])
  24 +const evaluateType = ref()
24 const score = ref(5) 25 const score = ref(5)
25 const textareaShow = ref(true) 26 const textareaShow = ref(true)
26 const textareaPlaceholder = ref("请输入对此次服务得评价") 27 const textareaPlaceholder = ref("请输入对此次服务得评价")
27 const content = ref("") 28 const content = ref("")
28 -const doSubmit = (orderId, score, content) => {  
29 - uploadEvaluate({ orderId, score, content }).then(res => { 29 +const doSubmit = (orderId, score, content, evaluateType) => {
  30 + uploadEvaluate({ orderId, score, content, evaluateType }).then(res => {
30 if (res.data.success) { 31 if (res.data.success) {
31 uni.$u.toast("评价成功") 32 uni.$u.toast("评价成功")
32 setTimeout(() => { 33 setTimeout(() => {
@@ -46,6 +47,7 @@ const blur = (e) =&gt; { @@ -46,6 +47,7 @@ const blur = (e) =&gt; {
46 } 47 }
47 onLoad((options) => { 48 onLoad((options) => {
48 orderId.value = options.orderId 49 orderId.value = options.orderId
  50 + evaluateType.value = options.userType === "居民用户" ? 0 : 1
49 // 积分初始化 51 // 积分初始化
50 for (let index = 0; index < maxScore.value; index++) { 52 for (let index = 0; index < maxScore.value; index++) {
51 maxStar.value.push(index); 53 maxStar.value.push(index);
garbage-removal/src/pages/order/swiper-list-item/index.vue
@@ -13,8 +13,14 @@ @@ -13,8 +13,14 @@
13 <view v-if="item.garOrderHandlerStatus === 0 && item.garCancelFlag === 0" class="right">待清运 </view> 13 <view v-if="item.garOrderHandlerStatus === 0 && item.garCancelFlag === 0" class="right">待清运 </view>
14 <view v-if="item.garCancelFlag === 1" class="right">已取消 </view> 14 <view v-if="item.garCancelFlag === 1" class="right">已取消 </view>
15 <view v-if="item.garOrderHandlerStatus === 1 && item.garCancelFlag === 0" class="right">清运中 </view> 15 <view v-if="item.garOrderHandlerStatus === 1 && item.garCancelFlag === 0" class="right">清运中 </view>
16 - <view v-if="item.garEvaluateFlag === 0 && item.garCancelFlag === 0" class="right">待评价 </view>  
17 - <view v-if="item.garEvaluateFlag === 1 && item.garCancelFlag === 0" class="right">已评价 </view> 16 + <view v-if="item.garEvaluateFlag === 0 && userType === '居民用户'" class="right">待评价
  17 + </view>
  18 + <view v-if="item.garHandlerEvaluateFlag === 0 && userType === '管理负责人'" class="right">待评价
  19 + </view>
  20 + <view v-if="item.garEvaluateFlag === 1 && userType === '居民用户'" class="right">已评价
  21 + </view>
  22 + <view v-if="item.garHandlerEvaluateFlag === 1 && userType === '管理负责人'" class="right">已评价
  23 + </view>
18 </view> 24 </view>
19 <view class="item" @click="handleClick(item.garOrderId)"> 25 <view class="item" @click="handleClick(item.garOrderId)">
20 <view class="left"> 26 <view class="left">
@@ -32,6 +38,24 @@ @@ -32,6 +38,24 @@
32 </view> 38 </view>
33 <view hover-class="btn-hover" class="logistics btn" @click="handleCancelOrder(item.garOrderId)">取消派单</view> 39 <view hover-class="btn-hover" class="logistics btn" @click="handleCancelOrder(item.garOrderId)">取消派单</view>
34 </view> 40 </view>
  41 + <!-- 用户对公司评价 -->
  42 + <view class="bottom"
  43 + v-if="item.garEvaluateFlag === 0 && item.garOrderHandlerStatus === 3 && userType === '居民用户'">
  44 + <view class="more">
  45 + <!-- <u-icon name="more-dot-fill" color="rgb(203,203,203)"></u-icon> -->
  46 + </view>
  47 + <view hover-class="btn-hover" class="logistics btn" @click="handleUserEvaluate(item.garOrderId, userType)">去评价
  48 + </view>
  49 + </view>
  50 + <!-- 公司对用户评价 -->
  51 + <view class="bottom"
  52 + v-if="item.garHandlerEvaluateFlag === 0 && item.garOrderHandlerStatus === 3 && userType === '管理负责人'">
  53 + <view class="more">
  54 + <!-- <u-icon name="more-dot-fill" color="rgb(203,203,203)"></u-icon> -->
  55 + </view>
  56 + <view hover-class="btn-hover" class="logistics btn" @click="handleUserEvaluate(item.garOrderId, userType)">去评价
  57 + </view>
  58 + </view>
35 </view> 59 </view>
36 </view> 60 </view>
37 </z-paging> 61 </z-paging>
@@ -43,7 +67,8 @@ @@ -43,7 +67,8 @@
43 67
44 <script setup> 68 <script setup>
45 import { queryOrderList, updateOrder } from "@/apis/order.js"; 69 import { queryOrderList, updateOrder } from "@/apis/order.js";
46 -import { ref, watch } from 'vue'; 70 +import { useMainStore } from '@/stores/index.js';
  71 +import { computed, ref, watch } from 'vue';
47 const props = defineProps({ 72 const props = defineProps({
48 tabIndex: { 73 tabIndex: {
49 type: Number 74 type: Number
@@ -53,6 +78,8 @@ const props = defineProps({ @@ -53,6 +78,8 @@ const props = defineProps({
53 } 78 }
54 }) 79 })
55 80
  81 +const store = useMainStore();
  82 +const userType = computed(() => store.userType)
56 const currentCancelOrderId = ref(""); 83 const currentCancelOrderId = ref("");
57 const currentCancelName = ref(""); 84 const currentCancelName = ref("");
58 const cancelShow = ref(false) 85 const cancelShow = ref(false)
@@ -127,6 +154,14 @@ const handleClick = (orderId) =&gt; { @@ -127,6 +154,14 @@ const handleClick = (orderId) =&gt; {
127 } 154 }
128 }) 155 })
129 } 156 }
  157 +
  158 +/**
  159 + * 订单评价
  160 + * @param {*} orderId
  161 + */
  162 +const handleUserEvaluate = (orderId, userType) => {
  163 + uni.$u.route(`pages/order/evaluate/index?orderId=${orderId}&userType=${userType}`)
  164 +}
130 // list集合 165 // list集合
131 const queryList = (pageNo, pageSize) => { 166 const queryList = (pageNo, pageSize) => {
132 //这里的pageNo和pageSize会自动计算好,直接传给服务器即可 167 //这里的pageNo和pageSize会自动计算好,直接传给服务器即可
garbage-removal/src/pages/wode/choose/index.vue
@@ -31,6 +31,7 @@ const submit = (userType) =&gt; { @@ -31,6 +31,7 @@ const submit = (userType) =&gt; {
31 store.token = store.tempToken 31 store.token = store.tempToken
32 store.tempToken = ""; 32 store.tempToken = "";
33 if (res.data.success) { 33 if (res.data.success) {
  34 + store.userType = userType;
34 uni.$u.route({ 35 uni.$u.route({
35 type: "switchTab", 36 type: "switchTab",
36 url: `pages/home/index`, 37 url: `pages/home/index`,
garbage-removal/src/stores/main.js
@@ -5,8 +5,9 @@ export const useMainStore = defineStore( @@ -5,8 +5,9 @@ export const useMainStore = defineStore(
5 () => { 5 () => {
6 const token = ref(null); 6 const token = ref(null);
7 const tempToken = ref(null); 7 const tempToken = ref(null);
  8 + const userType = ref("")
8 9
9 - return { token,tempToken }; 10 + return { token,tempToken,userType };
10 }, 11 },
11 { 12 {
12 persist: { 13 persist: {