detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view style="background-color: #fff;padding: 20rpx 0;">
  3. <up-steps :current="current" dot activeColor="#0279FE">
  4. <up-steps-item v-for="item in steps" :key="item.title" :title="item.title" />
  5. </up-steps>
  6. </view>
  7. <view class="main">
  8. <view class="billno" style="margin-bottom: -24rpx;">
  9. 工单编号:{{ detail.billno }}
  10. </view>
  11. <view class="row">
  12. <view class="label col-center">服务类型</view>
  13. <view class="servicetype"
  14. :style="{ 'background': { '安装': '#70B603', '维修': '#D9001B', '清洁': '#3874F6', '清洗': '#3874F6' }[detail.servicetype] || '#999999' }">
  15. {{ detail.servicetype || '--' }}</view>
  16. </view>
  17. <view class="row">
  18. <view class="label">产品品类</view>
  19. <view class="value">{{ detail.class1 || '--' }}</view>
  20. </view>
  21. <view class="row" v-if="detail.servicetype == '维修'">
  22. <view class="label">故障类型</view>
  23. <view class="value">{{ detail.reason || '--' }}</view>
  24. </view>
  25. <view class="row">
  26. <view class="label">服务地址</view>
  27. <view class="value">{{ detail.province + detail.city + detail.county + detail.address || '--' }}</view>
  28. </view>
  29. <view class="row" style="align-items: center;">
  30. <view class="label justify">联系人</view>
  31. <view class="value phonenumber">{{ detail.scenecontact || '--' }}
  32. <block v-if="detail.scenecontactphonenumber">
  33. <text style="margin: 0 20rpx 0 10rpx;">
  34. {{ detail.scenecontactphonenumber }}
  35. </text>
  36. <My-button :customStyle="{
  37. width: '142rpx',
  38. height: '48rpx',
  39. 'background-color': '#FFFFFF',
  40. 'color': '#3874F6',
  41. borderRadius: '10rpx'
  42. }" :frontIconStyle="{
  43. marginRight: '6rpx',
  44. }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="detail.scenecontactphonenumber" />
  45. </block>
  46. </view>
  47. </view>
  48. <view class="row">
  49. <view class="label">派单日期</view>
  50. <view class="value">{{ detail.createdate || '--' }}</view>
  51. </view>
  52. <view class="row">
  53. <view class="label">服务需求</view>
  54. <view class="value">{{ detail.remarks || '--' }}</view>
  55. </view>
  56. <up-divider />
  57. <view class="row" v-if="detail.enterprisename">
  58. <view class="label justify">销售商</view>
  59. <view class="value">{{ detail.enterprisename || '--' }}</view>
  60. </view>
  61. <view class="row" v-if="detail.itemsText.length">
  62. <view class="label">产品信息</view>
  63. <view class="value">
  64. <view class="col-center" v-for="(item, index) in detail.itemsText" :key="index">
  65. <view class="value"><text v-if="detail.itemsText.length != 1">{{ index + 1 }}. </text>{{ item }}
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="row" v-if="detail.sku">
  71. <view class="label justify">序列号</view>
  72. <view class="value">{{ detail.sku || '--' }}</view>
  73. </view>
  74. <view class="row" v-if="detail.customername || detail.customerphonenumber" style="align-items: center;">
  75. <view class="label justify">客户信息</view>
  76. <view class="value phonenumber">{{ detail.customername || '' }}
  77. <block v-if="detail.customerphonenumber">
  78. <text style="margin: 0 20rpx 0 10rpx;">
  79. {{ detail.customerphonenumber }}
  80. </text>
  81. <My-button :customStyle="{
  82. width: '142rpx',
  83. height: '48rpx',
  84. 'background-color': '#FFFFFF',
  85. 'color': '#3874F6',
  86. borderRadius: '10rpx'
  87. }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="detail.customerphonenumber" />
  88. </block>
  89. </view>
  90. </view>
  91. <view class="row" v-if="detail.servicetype !== '安装' && detail.cardno">
  92. <view class="label">保修信息</view>
  93. <view class="value">
  94. <text :style="{ color: detail.inqualityguaranteeperiod ? '#70B603' : '#D9001B' }"
  95. style="margin-right: 0rpx;">
  96. {{ detail.inqualityguaranteeperiod ? '在保' : '已过保' }}
  97. </text>
  98. {{ detail.cardno || '' }}
  99. <view v-if="detail.cardno" style="margin-top: 20rpx;">
  100. {{ item.begdate || '' }} - {{ item.enddate || '' }}
  101. </view>
  102. </view>
  103. </view>
  104. <!-- 底部按钮 -->
  105. <view v-if="detail.status == '待接单'" class="but-box">
  106. <view class="but-box-item" v-if="detail.customerphonenumber">
  107. <My-button :customStyle="{
  108. 'background-color': '#FFFFFF',
  109. 'color': '#3874F6',
  110. }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="detail.customerphonenumber" />
  111. </view>
  112. <view class="but-box-item" @click="takeOrderShow = true">
  113. <My-button frontIcon="icon-dianhua" text="接单" />
  114. <up-modal negativeTop="100" :show="takeOrderShow" title="是否确认接单?" showCancelButton @confirm="takeOrders"
  115. @cancel="takeOrderShow = false" ref="uModal" :asyncClose="true"></up-modal>
  116. </view>
  117. </view>
  118. <!-- 底部按钮 -->
  119. <view v-else-if="detail.status == '待开始'" class="but-box">
  120. <view class="but-box-item" @click="toChangeMsg">
  121. <My-button :customStyle="{
  122. 'background-color': '#FFFFFF',
  123. 'color': '#3874F6',
  124. }" text="信息修改" />
  125. </view>
  126. <view class="but-box-item" @click="confirmStartShow = true">
  127. <My-button text="确认开始" />
  128. <up-modal negativeTop="100" :show="confirmStartShow" showCancelButton @confirm="confirmStart"
  129. @cancel="confirmStartShow = false" ref="uModal" :asyncClose="true">
  130. <view class="slot-content">
  131. <view>
  132. 请仔细核对服务信息和客户信息
  133. </view>
  134. <view style="margin-top: 20rpx;">
  135. 开始工单后确认信息将不可修改!
  136. </view>
  137. </view>
  138. </up-modal>
  139. </view>
  140. </view>
  141. </view>
  142. </template>
  143. <script setup>
  144. import { ref, reactive, getCurrentInstance } from 'vue';
  145. const { $Http } = getCurrentInstance().proxy;
  146. import { onLoad, onShow } from '@dcloudio/uni-app';
  147. const current = ref(-1);
  148. const steps = reactive([
  149. { title: '接单', value: '待接单' },
  150. { title: '开始', value: '待开始' },
  151. { title: '进行中', value: '进行中' },
  152. { title: '提交', value: '提交' },
  153. { title: '完工', value: '已完成' }
  154. ]);
  155. let sa_workorderid = 0;
  156. onLoad((options) => {
  157. sa_workorderid = options.id;
  158. });
  159. onShow(() => {
  160. getDetail()
  161. })
  162. let detail = reactive({
  163. itemsText: []
  164. });
  165. function getDetail() {
  166. $Http.basic({ "id": "20230208140103", "content": { "nocache": true, sa_workorderid } }).then(res => {
  167. console.log("工单详情", res)
  168. if (res.code !== 1) return uni.showToast({ title: res.msg, icon: 'none' });
  169. res.data.itemsText = res.data.titems.map(item => {
  170. return `${item.itemname} ${item.model}`;
  171. })
  172. detail = reactive(res.data);
  173. current.value = steps.findIndex(item => item.value === res.data.status);
  174. })
  175. }
  176. // 接单
  177. const takeOrderShow = ref(false);
  178. function takeOrders() {
  179. $Http.basic({
  180. id: 20230210101103,
  181. "content": {
  182. "sa_workorderid": detail.sa_workorderid
  183. }
  184. }).then(res => {
  185. console.log("接单结果", res)
  186. if (res.code == 1) {
  187. takeOrderShow.value = false;
  188. getDetail();
  189. uni.showToast({
  190. title: '接单成功',
  191. icon: 'none'
  192. });
  193. } else {
  194. if (res.msg) uni.showToast({
  195. title: res.msg,
  196. icon: 'none'
  197. });
  198. }
  199. })
  200. }
  201. // 修改信息
  202. function toChangeMsg() {
  203. uni.navigateTo({
  204. url: `/pages/workOrder/changeMsg?id=` + sa_workorderid
  205. });
  206. };
  207. // 确认开始
  208. const confirmStartShow = ref(false);
  209. function confirmStart() {
  210. $Http.basic({
  211. id: 20230209144503,
  212. "content": {
  213. "sa_workorderid": detail.sa_workorderid
  214. }
  215. }).then(res => {
  216. console.log("确认开始", res)
  217. if (res.code == 1) {
  218. confirmStartShow.value = false;
  219. getDetail();
  220. uni.showToast({
  221. title: '确认开始成功',
  222. icon: 'none'
  223. });
  224. } else {
  225. if (res.msg) uni.showToast({
  226. title: res.msg,
  227. icon: 'none'
  228. });
  229. }
  230. })
  231. }
  232. </script>
  233. <style lang="scss" scoped>
  234. .main {
  235. width: 690rpx;
  236. background: #FFFFFF;
  237. box-shadow: 0rpx 4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
  238. border-radius: 10rpx;
  239. box-sizing: border-box;
  240. padding: 40rpx;
  241. margin: 40rpx auto 0;
  242. overflow: hidden;
  243. .row {
  244. display: flex;
  245. font-size: 28rpx;
  246. font-family: Microsoft YaHei, Microsoft YaHei;
  247. line-height: 32rpx;
  248. margin-top: 20rpx;
  249. .label {
  250. position: relative;
  251. width: 108rpx;
  252. color: #999999;
  253. box-sizing: border-box;
  254. flex-shrink: 0;
  255. margin-right: 30rpx;
  256. }
  257. .label::after {
  258. position: absolute;
  259. top: 0;
  260. right: -12rpx;
  261. content: ':';
  262. }
  263. .value {
  264. color: #333333;
  265. }
  266. .phonenumber {
  267. width: 100%;
  268. display: flex;
  269. align-items: center;
  270. }
  271. .servicetype {
  272. border-radius: 8rpx;
  273. padding: 8rpx 16rpx;
  274. font-weight: bold;
  275. color: #fff;
  276. }
  277. }
  278. .col-center {
  279. display: flex;
  280. align-items: center;
  281. }
  282. .col-center::after {
  283. top: 50% !important;
  284. transform: translateY(-50%);
  285. }
  286. .justify {
  287. text-align: justify;
  288. text-align-last: justify;
  289. }
  290. .billno {
  291. position: relative;
  292. width: 400rpx;
  293. top: -40rpx;
  294. left: -40rpx;
  295. background: #3874F6;
  296. border-radius: 0 0rpx 24rpx 0rpx;
  297. padding: 10rpx 52rpx 10rpx 20rpx;
  298. font-family: Microsoft YaHei, Microsoft YaHei;
  299. font-size: 26rpx;
  300. color: #FFFFFF;
  301. }
  302. }
  303. .but-box {
  304. display: flex;
  305. align-items: center;
  306. justify-content: space-around;
  307. margin-top: 40rpx;
  308. .but-box-item {
  309. width: 45%;
  310. }
  311. }
  312. </style>