orderDetail.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view class="client-detail detail" v-if="detail.id">
  3. <view class="detail-box">
  4. <view class="title-box">
  5. <view class="title">{{detail.name}}</view>
  6. <view class="date">{{detail.date}}</view>
  7. <view class="title-icon">
  8. <uni-icons type="wallet-filled" color="#fff" size="20"></uni-icons>
  9. </view>
  10. </view>
  11. <view class="other">
  12. <div class="item" v-if="detail.type !== 3">
  13. <div class="label">关联租客</div>
  14. <div class="value"> {{detail.tenantType === 1 ? detail.merchantName: detail.clientName}}</div>
  15. </div>
  16. <view class="item" v-if="detail.type === 3">
  17. <view class="label">合同编码</view>
  18. <view class="value">{{detail.contractCode}}</view>
  19. </view>
  20. <div class="item">
  21. <div class="label">跟进人</div>
  22. <div class="value">{{detail.followUpPersonName}}</div>
  23. </div>
  24. <div class="item">
  25. <div class="label">联系电话</div>
  26. <div class="value">{{detail.followUpPersonPhone}}</div>
  27. </div>
  28. <div class="item" v-if="detail.type !== 3">
  29. <div class="label">服务方式</div>
  30. <div class="value">
  31. {{detail.type === 1?$field.findTypeName('serviceWorkWay',detail.workWay):$field.findTypeName('clearWorkWay',detail.workWay)}}
  32. </div>
  33. </div>
  34. <div class="item">
  35. <div class="label">摘要</div>
  36. <div class="value">{{detail.compendious || ''}}</div>
  37. </div>
  38. </view>
  39. <view class="state">
  40. <view class="create">
  41. <uni-icons class="inherit-icons" type="staff-filled" color="#08979c" size="18"></uni-icons>
  42. <text class="name hui-ellipsis">{{detail.followUpPersonName || '-'}}</text>
  43. </view>
  44. <view class="tag">
  45. <div class="status-tag info" v-if="!detail.status">待提交</div>
  46. <div class="status-tag primary" v-else-if="detail.status === 1">待处理</div>
  47. <div class="status-tag warning" v-else-if="detail.status === 2">处理中</div>
  48. <div class="status-tag success" v-else>已处理</div>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="detail-box file-box" v-if="detail.attachment && detail.attachment !='[]'">
  53. <view class="sub-title">
  54. <uni-icons type="images-filled" class="inherit-icons" size="26" color="#08979c"></uni-icons>
  55. <text class="sub-label">工单附件</text>
  56. </view>
  57. <view class="other">
  58. <upload ref="upload" :list="detail.attachment ? JSON.parse(detail.attachment) : []" type="preview">
  59. </upload>
  60. </view>
  61. </view>
  62. <view class="detail-box" v-if="detail.data && detail.data != '[]'">
  63. <view class="sub-title">
  64. <uni-icons type="calendar-filled" class="inherit-icons" size="26" color="#08979c"></uni-icons>
  65. <text class="sub-label">自定义信息</text>
  66. </view>
  67. <view class="other">
  68. <div class="item" v-for="(item,index) in JSON.parse(detail.data)" :key="index">
  69. <div class="label">{{item.keyName}}</div>
  70. <div class="value">{{item.value}}</div>
  71. </div>
  72. </view>
  73. </view>
  74. <view class="detail-box" v-if="detail.workOrderProcessList.length > 0">
  75. <view class="sub-title">
  76. <uni-icons type="map-filled" class="inherit-icons" size="24" color="#08979c"></uni-icons>
  77. <text class="sub-label">工单过程</text>
  78. </view>
  79. <process :process="detail.workOrderProcessList" v-if="detail.workOrderProcessList.length > 0">
  80. </process>
  81. </view>
  82. <view class="hui-button-box" v-if="actionButton.length > 0">
  83. <view class="hui-button" v-for="(item,index) in actionButton" :key="index" @click="actionClick(item.type)">
  84. {{item.name}}
  85. </view>
  86. </view>
  87. </view>
  88. </template>
  89. <script>
  90. import {
  91. getOrderDetailById,
  92. updateOrder
  93. } from '@/request/api/order.js'
  94. import upload from '@/components/common/upload.vue';
  95. import process from '@/components/common/process.vue';
  96. export default {
  97. data() {
  98. return {
  99. orderId: '',
  100. detail: {},
  101. user: {},
  102. actionButton: [],
  103. operation: {},
  104. }
  105. },
  106. onLoad(body) {
  107. if (body.orderId) this.orderId = body.orderId;
  108. this.init();
  109. this.user = this.$store.getters.user;
  110. uni.$on('reloadOrderDetail', () => {
  111. this.init();
  112. })
  113. },
  114. methods: {
  115. init() {
  116. if (!this.orderId) return;
  117. getOrderDetailById(this.orderId).then(res => {
  118. if (res.code === 200) {
  119. this.detail = res.data;
  120. this.role();
  121. }
  122. })
  123. },
  124. role() {
  125. let user = this.$store.getters.user,
  126. button = [];
  127. if (this.detail.userId === user.userId) { //创建者
  128. if (!this.detail.status) button.push({
  129. type: 1,
  130. name: '提交工单'
  131. })
  132. }
  133. let data = this.detail.workOrderProcessList.filter(node => !node.status);
  134. if (data.length > 0) { //未处理工单过程
  135. this.operation = data[0];
  136. //处理工单人员
  137. if (this.operation.operatorId === user.userId) button.push({
  138. type: 2,
  139. name: '处理工单'
  140. })
  141. }
  142. if (this.detail.followUpPerson === user.userId) { //跟进人
  143. if (this.detail.status === 1) button.push({
  144. type: 3,
  145. name: '开始工单'
  146. })
  147. if (this.detail.status === 2) button.push({
  148. type: 4,
  149. name: '指派人员'
  150. })
  151. if (data.length === 0 && this.detail.status === 2) button.push({
  152. type: 5,
  153. name: '完成工单'
  154. })
  155. }
  156. this.actionButton = button;
  157. },
  158. actionClick(type) {
  159. switch (type) {
  160. case 1:
  161. this.submitOrder('是否提交工单,提交后将不能再修改?', 1);
  162. break;
  163. case 2:
  164. this.$navigateTo('/pageIndex/orderHandle/orderHandle?operationId=' + this.operation.id);
  165. break;
  166. case 3:
  167. this.submitOrder('是否开始工单?', 2);
  168. break;
  169. case 4:
  170. this.$navigateTo('/pageIndex/selectUser/selectUser?orderId=' + this.detail.id);
  171. break;
  172. case 5:
  173. this.submitOrder('是否完成工单?', 3);
  174. break;
  175. default:
  176. break;
  177. }
  178. },
  179. submitOrder(msg, status) {
  180. uni.showModal({
  181. title: '有极提示',
  182. content: msg,
  183. success: res => {
  184. if (res.confirm) {
  185. this.update(status);
  186. }
  187. }
  188. });
  189. },
  190. update(status) {
  191. uni.showLoading();
  192. updateOrder({
  193. id: this.detail.id,
  194. status: status
  195. }).then(res => {
  196. if (res.code === 200) {
  197. this.init();
  198. this.$toast('操作成功')
  199. uni.$emit('reloadOrder');
  200. }
  201. uni.hideLoading();
  202. })
  203. },
  204. },
  205. components: {
  206. upload,
  207. process
  208. },
  209. }
  210. </script>
  211. <style lang="scss">
  212. .client-detail {
  213. padding-bottom: 100rpx;
  214. }
  215. </style>