business-item.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="top">
  5. <text class="title">业务详情</text>
  6. </view>
  7. </view>
  8. <view class="card-box">
  9. <view class="card" v-for="(businessItem,index) in items" :key="businessItem.id">
  10. <view class="t">
  11. 订单号:
  12. <text class="title">{{ businessItem.no }}</text>
  13. </view>
  14. <view class="c">
  15. <view class="item car-num-item">
  16. <text class="car-num">{{ businessItem.goodsName }}</text>
  17. </view>
  18. </view>
  19. <view class="c">
  20. <view class="item">
  21. <text class="p1">类型:</text>
  22. <text class="p2">{{ businessItem.itemTypeName }}</text>
  23. </view>
  24. </view>
  25. <view class="c">
  26. <view class="item">
  27. <text class="p1">作业项:</text>
  28. <text class="p2">{{ businessItem.itemName }}</text>
  29. </view>
  30. </view>
  31. <view class="c" v-if="businessItem.cardNo">
  32. <view class="item">
  33. <text class="p1">越南车:</text>
  34. <text class="p2">{{ businessItem.cardNo }}</text>
  35. </view>
  36. </view>
  37. <view class="c" v-if="businessItem.chinaCarNo">
  38. <view class="item">
  39. <text class="p1">中国车:</text>
  40. <text class="p2">{{ businessItem.chinaCarNo }}</text>
  41. </view>
  42. </view>
  43. <view class="c">
  44. <view class="item">
  45. <text class="p1">录入时间:</text>
  46. <text class="p2">{{ businessItem.createTime }}</text>
  47. </view>
  48. </view>
  49. <view class="c">
  50. <view class="item">
  51. <text class="p1">状态:</text>
  52. <text class="p2">
  53. <text v-if="businessItem.pick==1">已接单</text>
  54. <text v-else>未接单</text>
  55. </text>
  56. </view>
  57. </view>
  58. <view class="c">
  59. <view class="item" v-if="businessItem.pickTime">
  60. <text class="p1">接单时间:</text>
  61. <text class="p2">
  62. <text>{{ businessItem.pickTime }}</text>
  63. </text>
  64. </view>
  65. </view>
  66. <view class="c">
  67. <view class="item" v-if="businessItem.pickCustomerName">
  68. <text class="p1">接单企业:</text>
  69. <text class="p2">
  70. <text>{{ businessItem.pickCustomerName }}</text>
  71. </text>
  72. </view>
  73. </view>
  74. <view class="c" v-if="businessItem.pick==1">
  75. <view class="item">
  76. <text class="p1">确认状态:</text>
  77. <text class="p2">
  78. <text v-if="businessItem.confirm==1">已确认</text>
  79. <text v-else>未确认</text>
  80. </text>
  81. </view>
  82. </view>
  83. <view class="c" v-if="businessItem.confirm==1">
  84. <view class="item">
  85. <text class="p1">确认时间:</text>
  86. <text class="p2">
  87. <text>{{ businessItem.confirmTime }}</text>
  88. </text>
  89. </view>
  90. </view>
  91. <view class="b" v-if="customerId=='1'&&businessItem.pick==1&&businessItem.confirm!=1">
  92. <view class="btn b3" @click="pickFn(businessItem.id)">
  93. 确认
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </template>
  100. <script>
  101. export default {
  102. data() {
  103. return {
  104. customerId: '',
  105. openid: '',
  106. form: {},
  107. items: [],
  108. itemId: '',
  109. }
  110. },
  111. onLoad(options) {
  112. this.form.id = options.id;
  113. this.itemId = options.itemId;
  114. this.openid = options.openid;
  115. this.checkLogin();
  116. },
  117. onShow() {
  118. this.customerId = uni.getStorageSync('customerId')
  119. if (this.itemId) {
  120. this.getBusinessItem()
  121. } else {
  122. this.getBusinessById();
  123. }
  124. },
  125. onBackPress() {
  126. this.$common.to('/pages/index/index')
  127. return true;
  128. },
  129. methods: {
  130. getBusinessItem() {
  131. this.$api.getBusinessItem({
  132. id: this.itemId
  133. }).then(resp => {
  134. let data = resp.data;
  135. if (!data) {
  136. this.$common.toast('该业务已取消或删除');
  137. setTimeout(() => {
  138. this.$common.to('/pages/index/index')
  139. }, 2000)
  140. return;
  141. }
  142. this.items = [resp.data];
  143. })
  144. },
  145. checkLogin() {
  146. let token = uni.getStorageSync('token');
  147. if (this.openid && !token) {
  148. this.$api.doLoginByOpenid({
  149. openid: this.openid
  150. }).then(resp => {
  151. let data = resp.data;
  152. if (data.tokenInfo) {
  153. uni.setStorageSync('token', data.tokenInfo.tokenValue);
  154. uni.setStorageSync('customerId', data.admin.customerId)
  155. uni.setStorageSync('info', data.admin)
  156. uni.setStorageSync('perList', data.per_list)
  157. } else {
  158. this.$common.toast(resp.msg);
  159. }
  160. })
  161. }
  162. },
  163. getBusinessById() {
  164. this.$api.getBusinessById({
  165. id: this.form.id
  166. }).then(resp => {
  167. let data = resp.data;
  168. this.items = resp.data.items.filter(obj => obj.businessType !== 0);
  169. })
  170. },
  171. pickFn(id) {
  172. let that = this;
  173. uni.showModal({
  174. title: '提示',
  175. content: '是否确认该业务项?',
  176. success(resp) {
  177. if (resp.confirm) {
  178. that.surePick(id);
  179. }
  180. }
  181. })
  182. },
  183. surePick(id) {
  184. this.$api.confirmBusinessItem({
  185. id: id
  186. }).then(resp => {
  187. if (resp.code == 200) {
  188. this.$common.toast('已确认');
  189. this.getBusinessById();
  190. }
  191. })
  192. }
  193. }
  194. }
  195. </script>
  196. <style lang="scss">
  197. .card-box {
  198. display: flex;
  199. width: 100%;
  200. flex-direction: column;
  201. .card {
  202. background-color: #fff;
  203. border-radius: 20rpx;
  204. margin: 20rpx 20rpx 0 20rpx;
  205. padding: 30rpx;
  206. box-sizing: border-box;
  207. display: flex;
  208. flex-direction: column;
  209. .t {
  210. width: 100%;
  211. display: flex;
  212. align-items: center;
  213. padding-bottom: 30rpx;
  214. border-bottom: 1rpx solid #f5f5f5;
  215. .icon {
  216. width: 40rpx;
  217. height: 40rpx;
  218. }
  219. .title {
  220. font-size: 35rpx;
  221. font-weight: bold;
  222. margin-left: 20rpx;
  223. }
  224. }
  225. .c {
  226. padding: 15rpx 0 30rpx 0;
  227. display: flex;
  228. flex-wrap: wrap;
  229. border-bottom: 1rpx solid #f5f5f5;
  230. .item {
  231. padding: 20rpx 0;
  232. .car-num {
  233. background-color: #edf6ff;
  234. color: #0080ff;
  235. font-size: 38rpx;
  236. padding: 15rpx 0;
  237. text-align: center;
  238. width: 100%;
  239. border-radius: 10rpx;
  240. font-weight: bold;
  241. }
  242. .p1 {
  243. font-size: 28rpx;
  244. color: #999;
  245. }
  246. .p2 {
  247. font-size: 28rpx;
  248. color: #191919;
  249. font-weight: bold;
  250. margin-left: 20rpx;
  251. }
  252. }
  253. .car-num-item {
  254. width: 100%;
  255. display: flex;
  256. align-items: center;
  257. justify-content: center;
  258. }
  259. }
  260. .b {
  261. display: flex;
  262. width: 100%;
  263. align-items: center;
  264. justify-content: space-between;
  265. .btn {
  266. height: 70rpx;
  267. display: flex;
  268. align-items: center;
  269. justify-content: center;
  270. width: calc(100% - 15rpx);
  271. margin: 30rpx 0 0 0;
  272. border-radius: 10rpx;
  273. border-width: 1rpx;
  274. box-sizing: border-box;
  275. }
  276. .b1 {
  277. background-color: #0080ff;
  278. color: #fff;
  279. }
  280. .b2 {
  281. background-color: #f7f7f7;
  282. color: #191919;
  283. }
  284. .b3 {
  285. background-color: #fff;
  286. color: #0080ff;
  287. border: 1rpx solid #0080ff;
  288. }
  289. .b4 {
  290. background-color: #ff0000;
  291. color: #fff;
  292. }
  293. }
  294. }
  295. }
  296. @import '@/common/common.scss'
  297. </style>