business-item.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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">
  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. 确认</view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </template>
  99. <script>
  100. export default {
  101. data() {
  102. return {
  103. customerId: '',
  104. openid: '',
  105. form: {},
  106. items: [],
  107. itemId:'',
  108. }
  109. },
  110. onLoad(options) {
  111. this.form.id = options.id;
  112. this.itemId=options.itemId;
  113. this.openid = options.openid;
  114. this.checkLogin();
  115. },
  116. onShow() {
  117. this.customerId = uni.getStorageSync('customerId')
  118. if(this.itemId){
  119. this.getBusinessItem()
  120. }else{
  121. this.getBusinessById();
  122. }
  123. },
  124. onBackPress() {
  125. this.$common.to('/pages/index/index')
  126. return true;
  127. },
  128. methods: {
  129. getBusinessItem() {
  130. this.$api.getBusinessItem({
  131. id: this.itemId
  132. }).then(resp => {
  133. let data = resp.data;
  134. if (!data) {
  135. this.$common.toast('该业务已取消或删除');
  136. setTimeout(() => {
  137. this.$common.to('/pages/index/index')
  138. }, 2000)
  139. return;
  140. }
  141. this.items = [resp.data];
  142. })
  143. },
  144. checkLogin() {
  145. let token = uni.getStorageSync('token');
  146. if (this.openid && !token) {
  147. this.$api.doLoginByOpenid({
  148. openid: this.openid
  149. }).then(resp => {
  150. let data = resp.data;
  151. if (data.tokenInfo) {
  152. uni.setStorageSync('token', data.tokenInfo.tokenValue);
  153. uni.setStorageSync('customerId', data.admin.customerId)
  154. uni.setStorageSync('info', data.admin)
  155. uni.setStorageSync('perList', data.per_list)
  156. } else {
  157. this.$common.toast(resp.msg);
  158. }
  159. })
  160. }
  161. },
  162. getBusinessById() {
  163. this.$api.getBusinessById({
  164. id: this.form.id
  165. }).then(resp => {
  166. let data = resp.data;
  167. this.items = resp.data.items.filter(obj => obj.businessType !== 0);
  168. })
  169. },
  170. pickFn(id) {
  171. let that = this;
  172. uni.showModal({
  173. title: '提示',
  174. content: '是否确认该业务项?',
  175. success(resp) {
  176. if (resp.confirm) {
  177. that.surePick(id);
  178. }
  179. }
  180. })
  181. },
  182. surePick(id) {
  183. this.$api.confirmBusinessItem({
  184. id: id
  185. }).then(resp => {
  186. if (resp.code == 200) {
  187. this.$common.toast('已确认');
  188. this.getBusinessById();
  189. }
  190. })
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="scss">
  196. .card-box {
  197. display: flex;
  198. width: 100%;
  199. flex-direction: column;
  200. .card {
  201. background-color: #fff;
  202. border-radius: 20rpx;
  203. margin: 20rpx 20rpx 0 20rpx;
  204. padding: 30rpx;
  205. box-sizing: border-box;
  206. display: flex;
  207. flex-direction: column;
  208. .t {
  209. width: 100%;
  210. display: flex;
  211. align-items: center;
  212. padding-bottom: 30rpx;
  213. border-bottom: 1rpx solid #f5f5f5;
  214. .icon {
  215. width: 40rpx;
  216. height: 40rpx;
  217. }
  218. .title {
  219. font-size: 35rpx;
  220. font-weight: bold;
  221. margin-left: 20rpx;
  222. }
  223. }
  224. .c {
  225. padding: 15rpx 0 30rpx 0;
  226. display: flex;
  227. flex-wrap: wrap;
  228. border-bottom: 1rpx solid #f5f5f5;
  229. .item {
  230. padding: 20rpx 0;
  231. .car-num {
  232. background-color: #edf6ff;
  233. color: #0080ff;
  234. font-size: 38rpx;
  235. padding: 15rpx 0;
  236. text-align: center;
  237. width: 100%;
  238. border-radius: 10rpx;
  239. font-weight: bold;
  240. }
  241. .p1 {
  242. font-size: 28rpx;
  243. color: #999;
  244. }
  245. .p2 {
  246. font-size: 28rpx;
  247. color: #191919;
  248. font-weight: bold;
  249. margin-left: 20rpx;
  250. }
  251. }
  252. .car-num-item {
  253. width: 100%;
  254. display: flex;
  255. align-items: center;
  256. justify-content: center;
  257. }
  258. }
  259. .b {
  260. display: flex;
  261. width: 100%;
  262. align-items: center;
  263. justify-content: space-between;
  264. .btn {
  265. height: 70rpx;
  266. display: flex;
  267. align-items: center;
  268. justify-content: center;
  269. width: calc(100% - 15rpx);
  270. margin: 30rpx 0 0 0;
  271. border-radius: 10rpx;
  272. border-width: 1rpx;
  273. box-sizing: border-box;
  274. }
  275. .b1 {
  276. background-color: #0080ff;
  277. color: #fff;
  278. }
  279. .b2 {
  280. background-color: #f7f7f7;
  281. color: #191919;
  282. }
  283. .b3 {
  284. background-color: #fff;
  285. color: #0080ff;
  286. border: 1rpx solid #0080ff;
  287. }
  288. .b4 {
  289. background-color: #ff0000;
  290. color: #fff;
  291. }
  292. }
  293. }
  294. }
  295. @import '@/common/common.scss'
  296. </style>