index.vue 9.3 KB

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