transferDetails.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <!-- 调拨详情 -->
  3. <view>
  4. <u-navbar :title="transferTitle" autoBack placeholder></u-navbar>
  5. <view style="padding: 0rpx 30rpx;">
  6. <view class="card_transfer_details" v-if="type == 0">
  7. <view class="step_title">接收人信息</view>
  8. <view class="card_avatar" style="margin-top: 10rpx;">
  9. <view style="display: flex;align-items: center;">
  10. <image class="mine_image" src="../../static/portrait.png" mode=""></image>
  11. <view class="card_user_title">
  12. <view class="mine_phone">{{userList.acceptUser.nickName || '接收人姓名'}}</view>
  13. <view class="mine_phone">{{userList.acceptCompany.name || '接收人所属门店'}}</view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="card_transfer_details" v-else>
  19. <view class="step_title">调拨人信息</view>
  20. <view class="card_avatar" style="margin-top: 10rpx;">
  21. <view style="display: flex;align-items: center;">
  22. <image class="mine_image" src="../../static/portrait.png" mode=""></image>
  23. <view class="card_user_title">
  24. <view class="mine_phone">{{userList.allotUser.nickName || '调拨人姓名'}}</view>
  25. <view class="mine_phone">{{userList.allotCompany.name || '调拨人所属门店'}}</view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view style="margin-top: 20rpx;padding-bottom: 20rpx;" class="space_between frame">
  31. <view class="title_code_a">单位内编号</view>
  32. <view class="num_code">总数: {{innerCodeData.length}}</view>
  33. </view>
  34. <u-checkbox-group v-model="checkedList" v-if="userList.status == 1 && type == 1" @change="checkboxChange">
  35. <view style="display: flex;flex-direction: column;width: 100%;">
  36. <view class="item_card_tran frame" v-for="(item,index) in innerCodeData">
  37. <u-checkbox :name="item.inner_code" :checked="item.checked"></u-checkbox>
  38. <view style="width: 60rpx;margin-right: 10rpx;text-align: center;">{{index + 1}}</view>
  39. <span style="font-weight: 600;">{{item.inner_code}}</span>
  40. </view>
  41. </view>
  42. </u-checkbox-group>
  43. <view style="display: flex;flex-direction: column;width: 100%;" v-else>
  44. <view class="item_card_tran frame space_between" v-for="(item,index) in innerCodeData">
  45. <view style="display: flex;align-items: center;">
  46. <view style="width: 60rpx;margin-right: 10rpx;text-align: center;">{{index + 1}}</view>
  47. <span style="font-weight: 600;">{{item.inner_code}}</span>
  48. </view>
  49. <view style="display: flex;align-items: center;" v-if="userList.status != 1">
  50. <view class="color_blue" v-if="item.flag">已接收</view>
  51. <view class="color_red" v-else>未接收</view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view style="width: 100%;height: 120rpx;"></view>
  57. <view class="btn_transfer_details" v-if="type == 1 && userList.status == 1">
  58. <!-- <view style="flex: 1;">
  59. <u-button style="width: 90%;" type="error" @click="cancelAllocation">取消</u-button>
  60. </view> -->
  61. <view style="flex: 1;">
  62. <u-button style="width: 90%;" type="primary" @click="submit">确定</u-button>
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. flowStep
  70. } from '@/static/js/blockSort.js'
  71. export default {
  72. data() {
  73. return {
  74. userList: {},
  75. type: null,
  76. transferTitle: '',
  77. checkedList: [],
  78. innerCodeData: [],
  79. }
  80. },
  81. onLoad(value) {
  82. this.type = Number(value.type)
  83. const data = uni.getStorageSync('transferData');
  84. if (data) {
  85. const userArr = JSON.parse(data)
  86. let array = flowStep()
  87. const filteredArray = array.filter(item => item.value === userArr.optType)
  88. if (filteredArray.length > 0) {
  89. this.transferTitle = filteredArray[0].label
  90. } else {
  91. this.transferTitle = '调拨详情'
  92. }
  93. this.userList = userArr
  94. // console.log(this.userList,25)
  95. const bmList = this.regroup(userArr.innerCodeList, true)
  96. const allList = this.regroup(userArr.acceptInnerCodeList)
  97. if (userArr.acceptInnerCodeList) {
  98. for (let i = 0; i < bmList.length; i++) {
  99. for (let v = 0; v < allList.length; v++) {
  100. if (bmList[i].inner_code == allList[v].inner_code) {
  101. bmList[i]['flag'] = true
  102. }
  103. }
  104. }
  105. }
  106. this.innerCodeData = bmList
  107. }
  108. },
  109. methods: {
  110. // 单位内编号数组重组
  111. regroup(arr, flag) {
  112. if (arr) {
  113. let innerCodeArr = []
  114. arr.forEach((item, index) => {
  115. let arr = {
  116. inner_code: item,
  117. checked: true,
  118. flag: false,
  119. }
  120. innerCodeArr.push(arr)
  121. if (flag) {
  122. this.checkedList.push(item)
  123. }
  124. })
  125. return innerCodeArr
  126. }
  127. },
  128. submit() {
  129. this.$api.post('/api/gas-cylinder-allot/submit', {
  130. id: this.userList.id,
  131. optType: this.userList.optType,
  132. allotUserId: this.userList.allotUserId,
  133. acceptUserId: this.userList.acceptUserId,
  134. allotCompanyId: this.userList.allotCompanyId,
  135. acceptCompanyId: this.userList.acceptCompanyId,
  136. innerCodeList: this.checkedList,
  137. }).then(res => {
  138. if (res.code == 200) {
  139. uni.navigateBack({
  140. delta: 1
  141. });
  142. } else {
  143. uni.$u.toast(res.data.msg)
  144. }
  145. })
  146. },
  147. // 选择钢瓶编号
  148. checkboxChange(value) {
  149. for (let i = 0; i < this.innerCodeData.length; i++) {
  150. let flag = value.includes(this.innerCodeData[i].inner_code);
  151. if (flag) {
  152. this.innerCodeData[i].checked = true
  153. } else {
  154. this.innerCodeData[i].checked = false
  155. }
  156. }
  157. this.checkedList = value
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. .step_title {
  164. font-size: 30rpx;
  165. font-weight: 600;
  166. }
  167. .card_avatar {
  168. display: flex;
  169. align-items: center;
  170. justify-content: space-between;
  171. }
  172. .mine_image {
  173. width: 100rpx;
  174. height: 100rpx;
  175. border-radius: 50%;
  176. }
  177. .card_user_title {
  178. display: flex;
  179. flex-direction: column;
  180. align-items: flex-start;
  181. }
  182. .mine_phone {
  183. margin-left: 20rpx;
  184. font-size: 30rpx;
  185. }
  186. .card_transfer_details {
  187. border: 1rpx dashed #d7d7d7;
  188. margin-top: 20rpx;
  189. padding: 20rpx;
  190. background-color: #f4f4f5;
  191. }
  192. .item_card_tran {
  193. display: flex;
  194. align-items: center;
  195. padding: 30rpx 30rpx 30rpx 0rpx;
  196. }
  197. .title_code_a {
  198. font-size: 32rpx;
  199. font-weight: 600;
  200. }
  201. .num_code {
  202. color: #2979ff;
  203. font-size: 28rpx;
  204. }
  205. .btn_transfer_details {
  206. position: fixed;
  207. bottom: 0;
  208. left: 0;
  209. right: 0;
  210. background-color: #fff;
  211. display: flex;
  212. align-items: center;
  213. padding: 20rpx 0rpx;
  214. border-top: 1rpx solid #f4f4f5;
  215. }
  216. .color_blue {
  217. color: #19be6b;
  218. font-size: 26rpx;
  219. }
  220. .color_red {
  221. color: #fa3534;
  222. font-size: 26rpx;
  223. }
  224. </style>