index.vue 9.5 KB

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