index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <template>
  2. <view class="u-page">
  3. <!-- <u&#45;&#45;input placeholder="请输入手机号或订单" prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399"-->
  4. <!-- v-model="numValue"></u&#45;&#45;input>-->
  5. <u-search shape="round" v-model="no" @search="getList(accountId,userId)"
  6. placeholder="请输入手机号或订单" input-align="center" :show-action="false"></u-search>
  7. <u-list @scrolltolower="scrolltolower">
  8. <view v-for="(item, index) in orderList" :key="index">
  9. <u-cell :value="item.CURRENT_VALUE" :isLink="true" :url="item.URL" :stop="false">
  10. <view slot="title" class="u-slot-title">
  11. <text class="u-cell-text">客户单号:{{item.CUSTOMER_REFFERENCE_ID}}</text>
  12. <u-tag :text="item.STATUS_TEXT" size="mini" :type="item.TEXT_TYPE"></u-tag>
  13. </view>
  14. <view slot="title" class="u-slot-title">
  15. <text class="u-cell-text">货主名称:{{item.CUSTOMER_NAME}}</text>
  16. </view>
  17. <view slot="title" class="u-slot-title">
  18. <text class="u-cell-text">收货方名称:{{item.RECEIVER_NAME}}</text>
  19. </view>
  20. <view style="display: flex;flex-direction: column;align-items: flex-start;padding-top: 10px" slot="label">
  21. <u-row>
  22. <u-button type="primary" size="mini" @click.native.stop="handleDetails(item)">明细详情</u-button>
  23. <u-button type="primary" size="mini" @click.native.stop="handleEvaluation($event,item)">{{item.EVALUATION_STATUS}}</u-button>
  24. </u-row>
  25. </view>
  26. </u-cell>
  27. </view>
  28. </u-list>
  29. <u-modal
  30. :show="show"
  31. :title="evaluationTitle"
  32. :showConfirmButton="true"
  33. :showCancelButton="true"
  34. @confirm="evaluationConfirm"
  35. @cancel="evaluationCancel"
  36. confirmText="提交评价"
  37. cancelText="取消"
  38. :closeOnClickOverlay="true"
  39. >
  40. <view class="evaluation-container">
  41. <view class="evaluation-item" v-for="(item, index) in evaluationItems" :key="index">
  42. <view class="evaluation-label">
  43. <text>{{item.label}}</text>
  44. </view>
  45. <view class="evaluation-rate">
  46. <u-rate
  47. :count="item.count"
  48. v-model="evaluation[item.field]"
  49. activeColor="#ff9900"
  50. inactiveColor="#dcdcdc"
  51. gutter="8"
  52. size="22"
  53. ></u-rate>
  54. </view>
  55. </view>
  56. <view class="evaluation-textarea">
  57. <view class="textarea-label">评价建议</view>
  58. <u--textarea
  59. v-model="evaluation.evaluationRemark"
  60. placeholder="请输入您的评价和建议..."
  61. count
  62. maxlength="200"
  63. height="100"
  64. :customStyle="{
  65. backgroundColor: '#f5f5f5',
  66. padding: '12rpx',
  67. borderRadius: '8rpx'
  68. }"
  69. ></u--textarea>
  70. </view>
  71. </view>
  72. </u-modal>
  73. </view>
  74. </template>
  75. <script>
  76. import {evaluationOrder, getOrderList,getOrderDetailList} from "@/api";
  77. export default {
  78. data() {
  79. return {
  80. no: undefined,
  81. accountId:undefined,
  82. userId:undefined,
  83. show:false,
  84. numValue:undefined,
  85. triggered:false,
  86. // evaluationShow:false,
  87. orderList: [],
  88. driverEvaluationCount: 4,
  89. customerServiceEvaluationCount: 4,
  90. warehouseEvaluationCount: 4,
  91. timelinessEvaluationCount: 4,
  92. goodsEvaluationCount: 4,
  93. evaluation: {
  94. orderCenterOrderId: undefined,
  95. driverEvaluation: 0,
  96. customerServiceEvaluation: 0,
  97. warehouseEvaluation: 0,
  98. timelinessEvaluation: 0,
  99. goodsEvaluation: 0,
  100. evaluationRemark: undefined,
  101. },
  102. evaluationTitle: '服务评价',
  103. evaluationItems: [
  104. { label: '司机服务', field: 'driverEvaluation', count: 4 },
  105. { label: '客服态度', field: 'customerServiceEvaluation', count: 4 },
  106. { label: '仓库服务', field: 'warehouseEvaluation', count: 4 },
  107. { label: '配送时效', field: 'timelinessEvaluation', count: 4 },
  108. { label: '货物状态', field: 'goodsEvaluation', count: 4 }
  109. ],
  110. indexList: [],
  111. urls: [
  112. "https://xxx.com/album/1.jpg",
  113. "https://xxx.com/album/2.jpg",
  114. "https://xxx.com/album/3.jpg",
  115. "https://xxx.com/album/4.jpg",
  116. "https://xxx.com/album/5.jpg",
  117. "https://xxx.com/album/6.jpg",
  118. "https://xxx.com/album/7.jpg",
  119. "https://xxx.com/album/8.jpg",
  120. "https://xxx.com/album/9.jpg",
  121. "https://xxx.com/album/10.jpg",
  122. ],
  123. };
  124. },
  125. created() {
  126. if (uni.getStorageSync('accountId')) {
  127. this.accountId = uni.getStorageSync('accountId')
  128. }
  129. if (uni.getStorageSync('userId')) {
  130. this.userId = uni.getStorageSync('userId')
  131. }
  132. this.getList(this.accountId,this.userId)
  133. },
  134. onLoad() {
  135. this.loadmore();
  136. },
  137. methods: {
  138. getList(accountId,userId){
  139. if(null == accountId || null == userId)
  140. {
  141. uni.showToast({
  142. title: "请重新登录",
  143. icon: "none"
  144. })
  145. return
  146. }
  147. // 获取当前订单list
  148. let params = {
  149. accountId: accountId,
  150. userId: userId
  151. }
  152. if (this.no){
  153. params.no = this.no
  154. }
  155. getOrderList(params).then(res => {
  156. if (res.data){
  157. // 对数据进行处理
  158. for (let i = 0; i < res.data.length; i++) {
  159. if (res.data[i].DRIVER_EVALUATION || res.data[i].WAREHOUSE_EVALUATION
  160. || res.data[i].CUSTOMER_SERVICE_EVALUATION || res.data[i].TIMELINESS_EVALUATION
  161. || res.data[i].GOODS_EVALUATION) {
  162. res.data[i].EVALUATION_STATUS = "已评价";
  163. } else {
  164. res.data[i].EVALUATION_STATUS = "待评价";
  165. }
  166. if (res.data[i].ORDER_CENTER_ORDER_STATUS === 300010) {
  167. res.data[i].STATUS_TEXT = "已审核";
  168. }
  169. else if (res.data[i].ORDER_CENTER_ORDER_STATUS === 300015 || res.data[i].ORDER_CENTER_ORDER_STATUS === 300020
  170. || res.data[i].ORDER_CENTER_ORDER_STATUS === 300025){
  171. res.data[i].STATUS_TEXT = "运输中";
  172. res.data[i].CURRENT_VALUE = "物流轨迹";
  173. res.data[i].URL = "/pages/index/tracktrace?id=" + res.data[i].ORDER_CENTER_ORDER_ID;
  174. res.data[i].TEXT_TYPE = "warning";
  175. }else if (res.data[i].ORDER_CENTER_ORDER_STATUS === 300030){
  176. res.data[i].STATUS_TEXT = "已签收";
  177. res.data[i].CURRENT_VALUE = "签收详情";
  178. res.data[i].URL = "/pages/index/signInfo?id=" + res.data[i].ORDER_CENTER_ORDER_ID;
  179. res.data[i].TEXT_TYPE = "success";
  180. }
  181. }
  182. this.orderList = res.data;
  183. }
  184. }).catch(err => {
  185. console.error(err);
  186. });
  187. },
  188. handleDetails(item) {
  189. // 跳转到orderDetailList页面并传递参数
  190. uni.navigateTo({
  191. url: `/pages/index/orderDetailList?accountId=${item.ACCOUNT_ID}&userId=${item.USER_ID}&orderCenterOrderId=${item.ORDER_CENTER_ORDER_ID}`
  192. });
  193. },
  194. handleEvaluation(event,item) {
  195. // 阻止事件冒泡,这样点击按钮就不会触发 u-cell 的点击事件了
  196. event.stopPropagation();
  197. if (item.EVALUATION_STATUS === "已评价") {
  198. uni.showToast({
  199. title: "当前已评价",
  200. icon: "none"
  201. })
  202. return
  203. }
  204. else {
  205. this.evaluation.orderCenterOrderId = item.ORDER_CENTER_ORDER_ID
  206. this.show = true
  207. console.log(this.show)
  208. }
  209. },
  210. evaluationConfirm() {
  211. // 提交评价
  212. evaluationOrder(this.evaluation).then(res => {
  213. if (res.code === "success") {
  214. uni.showToast({
  215. title: "评价成功",
  216. icon: "success"
  217. })
  218. this.getList()
  219. }
  220. }).catch(err => {
  221. uni.showToast({
  222. title: "评价失败",
  223. icon: err
  224. })
  225. })
  226. this.show = false
  227. },
  228. evaluationCancel() {
  229. // 取消评价
  230. this.evaluation = {
  231. orderCenterOrderId: undefined,
  232. driverEvaluation: 0,
  233. customerServiceEvaluation: 0,
  234. warehouseEvaluation: 0,
  235. timelinessEvaluation: 0,
  236. goodsEvaluation: 0,
  237. evaluationRemark: undefined
  238. },
  239. this.show = false
  240. },
  241. scrolltolower() {
  242. this.loadmore();
  243. },
  244. loadmore() {
  245. for (let i = 0; i < 30; i++) {
  246. this.indexList.push({
  247. url: this.urls[uni.$u.random(0, this.urls.length - 1)],
  248. });
  249. }
  250. },
  251. },
  252. };
  253. </script>
  254. <style lang="scss" scoped>
  255. @import '@/common/adaptive.scss';
  256. .cell-page {
  257. padding-bottom: 20px;
  258. }
  259. .cell-box {
  260. &__title {
  261. font-size: 14px;
  262. color: rgb(143, 156, 162);
  263. margin: 20px 0px 0px 15px;
  264. }
  265. &__block {
  266. // background-color: #fff;
  267. margin-top: 20px;
  268. }
  269. }
  270. .u-page {
  271. padding: 0;
  272. &__item {
  273. &__title {
  274. color: $u-tips-color;
  275. background-color: $u-bg-color;
  276. padding: 15px;
  277. font-size: 15px;
  278. &__slot-title {
  279. color: $u-primary;
  280. font-size: 14px;
  281. }
  282. }
  283. }
  284. }
  285. .u-slot-title {
  286. @include flex;
  287. flex-direction: row;
  288. align-items: center;
  289. margin-bottom: 4px;
  290. }
  291. .u-cell-text {
  292. font-size: 15px;
  293. line-height: 22px;
  294. color: #303133;
  295. margin-right: 5px;
  296. }
  297. .u-slot-value {
  298. line-height: 14px;
  299. text-align: center;
  300. font-size: 10px;
  301. padding: 0 5px;
  302. height: 17px;
  303. color: #FFFFFF;
  304. border-radius: 100px;
  305. background-color: #f56c6c;
  306. }
  307. /deep/ .u-button {
  308. min-width: 80px;
  309. margin-right: 10px;
  310. }
  311. /deep/ .u-cell {
  312. margin-bottom: 4px;
  313. }
  314. .evaluation-container {
  315. padding: 20rpx 30rpx;
  316. .evaluation-item {
  317. display: flex;
  318. align-items: center;
  319. justify-content: space-between;
  320. margin-bottom: 30rpx;
  321. .evaluation-label {
  322. font-size: 28rpx;
  323. color: #333;
  324. min-width: 140rpx;
  325. }
  326. .evaluation-rate {
  327. flex: 1;
  328. display: flex;
  329. justify-content: flex-end;
  330. }
  331. }
  332. .evaluation-textarea {
  333. margin-top: 20rpx;
  334. .textarea-label {
  335. font-size: 28rpx;
  336. color: #333;
  337. margin-bottom: 16rpx;
  338. }
  339. }
  340. }
  341. .u-modal {
  342. /deep/ .u-modal__title {
  343. font-size: 32rpx;
  344. font-weight: bold;
  345. color: #303133;
  346. }
  347. /deep/ .u-modal__content {
  348. padding: 30rpx 0;
  349. }
  350. /deep/ .u-modal__button {
  351. &--confirm {
  352. color: #2979ff;
  353. font-weight: bold;
  354. }
  355. &--cancel {
  356. color: #909399;
  357. }
  358. }
  359. }
  360. .your-component {
  361. @include respond-to('tablet') {
  362. // 平板样式
  363. }
  364. @include respond-to('desktop') {
  365. // 桌面样式
  366. }
  367. }
  368. </style>