transferDetails.vue 6.0 KB

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