transferDetails.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. <<<<<<< HEAD
  35. <u-checkbox-group v-model="checkedList" v-if="userList.status == 1 && type == 1" @change="checkboxChange">
  36. <view style="display: flex;flex-direction: column;width: 100%;">
  37. <view class="item_card_tran frame" v-for="(item,index) in innerCodeData">
  38. <u-checkbox :name="item.inner_code" :checked="item.checked"></u-checkbox>
  39. <view style="width: 60rpx;margin-right: 10rpx;text-align: center;">{{index + 1}}</view>
  40. <span style="font-weight: 600;">{{item.inner_code}}</span>
  41. </view>
  42. </view>
  43. </u-checkbox-group>
  44. <view style="display: flex;flex-direction: column;width: 100%;" v-else>
  45. <view class="item_card_tran frame space_between" v-for="(item,index) in innerCodeData">
  46. <view style="display: flex;align-items: center;">
  47. <view style="width: 60rpx;margin-right: 10rpx;text-align: center;">{{index + 1}}</view>
  48. <span style="font-weight: 600;">{{item.inner_code}}</span>
  49. </view>
  50. <view style="display: flex;align-items: center;" v-if="userList.status != 1">
  51. <view class="color_blue" v-if="item.flag">已接收</view>
  52. <view class="color_red" v-else>未接收</view>
  53. =======
  54. <u-checkbox-group v-model="checkedList" @change="checkboxChange">
  55. <view style="display: flex;flex-direction: column;width: 100%;">
  56. <view class="item_card_tran frame" v-for="(item,index) in innerCodeData">
  57. <view style="display: flex;align-items: center;">
  58. <u-checkbox :name="item.inner_code" :checked="item.checked"
  59. v-if="type == 1 && userList.status == 1"></u-checkbox>
  60. <view style="width: 60rpx;margin-right: 10rpx;text-align: center;">{{index + 1}}</view>
  61. <span style="font-weight: 600;">{{item.inner_code}}</span>
  62. </view>
  63. <view style="display: flex;align-items: center;" v-if="userList.status != 1">
  64. <span class="blue_title" v-if="item.flag">已接收</span>
  65. <span class="red_title" v-else>未接收</span>
  66. </view>
  67. >>>>>>> ec9bba9783fc5bf29c8b3276224b1ab4fab155dc
  68. </view>
  69. </view>
  70. </u-checkbox-group>
  71. </view>
  72. <view style="width: 100%;height: 120rpx;"></view>
  73. <view class="btn_transfer_details" v-if="type == 1 && userList.status == 1">
  74. <<<<<<< HEAD
  75. <!-- <view style="flex: 1;">
  76. <u-button style="width: 90%;" type="error" @click="cancelAllocation">取消</u-button>
  77. </view> -->
  78. =======
  79. >>>>>>> ec9bba9783fc5bf29c8b3276224b1ab4fab155dc
  80. <view style="flex: 1;">
  81. <u-button style="width: 90%;" type="primary" @click="submit">确定</u-button>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import {
  88. flowStep
  89. } from '@/static/js/blockSort.js'
  90. export default {
  91. data() {
  92. return {
  93. userList: {},
  94. type: null,
  95. transferTitle: '',
  96. checkedList: [],
  97. innerCodeData: [],
  98. }
  99. },
  100. onLoad(value) {
  101. this.type = Number(value.type)
  102. const data = uni.getStorageSync('transferData');
  103. if (data) {
  104. const userArr = JSON.parse(data)
  105. let array = flowStep()
  106. const filteredArray = array.filter(item => item.value === userArr.optType)
  107. if (filteredArray.length > 0) {
  108. this.transferTitle = filteredArray[0].label
  109. } else {
  110. this.transferTitle = '调拨详情'
  111. }
  112. this.checkedList = userArr.innerCodeList
  113. this.innerCodeData = []
  114. userArr.innerCodeList.forEach(item => {
  115. let arr = {
  116. inner_code: '',
  117. checked: true,
  118. }
  119. arr.inner_code = item
  120. if (userArr.acceptInnerCodeList == null) {
  121. userArr.acceptInnerCodeList = []
  122. }
  123. if (userArr.acceptInnerCodeList.indexOf(item) > -1) {
  124. arr.flag = true;
  125. } else {
  126. arr.flag = false;
  127. }
  128. this.innerCodeData.push(arr)
  129. })
  130. console.log(this.innerCodeData, userArr, 6767)
  131. this.userList = userArr
  132. // console.log(this.userList,25)
  133. const bmList = this.regroup(userArr.innerCodeList, true)
  134. const allList = this.regroup(userArr.acceptInnerCodeList)
  135. if (userArr.acceptInnerCodeList) {
  136. for (let i = 0; i < bmList.length; i++) {
  137. for (let v = 0; v < allList.length; v++) {
  138. if (bmList[i].inner_code == allList[v].inner_code) {
  139. bmList[i]['flag'] = true
  140. }
  141. }
  142. }
  143. }
  144. this.innerCodeData = bmList
  145. }
  146. },
  147. methods: {
  148. // 单位内编号数组重组
  149. regroup(arr, flag) {
  150. if (arr) {
  151. let innerCodeArr = []
  152. arr.forEach((item, index) => {
  153. let arr = {
  154. inner_code: item,
  155. checked: true,
  156. flag: false,
  157. }
  158. innerCodeArr.push(arr)
  159. if (flag) {
  160. this.checkedList.push(item)
  161. }
  162. })
  163. return innerCodeArr
  164. }
  165. },
  166. submit() {
  167. this.$api.post('/api/gas-cylinder-allot/submit', {
  168. id: this.userList.id,
  169. optType: this.userList.optType,
  170. allotUserId: this.userList.allotUserId,
  171. acceptUserId: this.userList.acceptUserId,
  172. allotCompanyId: this.userList.allotCompanyId,
  173. acceptCompanyId: this.userList.acceptCompanyId,
  174. innerCodeList: this.checkedList,
  175. }).then(res => {
  176. if (res.code == 200) {
  177. uni.navigateBack({
  178. delta: 1
  179. });
  180. } else {
  181. uni.$u.toast(res.data.msg)
  182. }
  183. })
  184. },
  185. <<<<<<< HEAD
  186. // 选择钢瓶编号
  187. checkboxChange(value) {
  188. for (let i = 0; i < this.innerCodeData.length; i++) {
  189. let flag = value.includes(this.innerCodeData[i].inner_code);
  190. if (flag) {
  191. this.innerCodeData[i].checked = true
  192. =======
  193. submit() {
  194. this.$api.post('/api/gas-cylinder-allot/submit', {
  195. id: this.userList.id,
  196. optType: this.userList.optType,
  197. allotUserId: this.userList.allotUserId,
  198. acceptUserId: this.userList.acceptUserId,
  199. allotCompanyId: this.userList.allotCompanyId,
  200. acceptCompanyId: this.userList.acceptCompanyId,
  201. innerCodeList: this.checkedList,
  202. }).then(res => {
  203. if (res.code == 200) {
  204. uni.navigateBack({
  205. delta: 1
  206. });
  207. >>>>>>> ec9bba9783fc5bf29c8b3276224b1ab4fab155dc
  208. } else {
  209. this.innerCodeData[i].checked = false
  210. }
  211. <<<<<<< HEAD
  212. }
  213. this.checkedList = value
  214. =======
  215. })
  216. },
  217. // 选择钢瓶
  218. checkboxChange(value) {
  219. for (let i = 0; i < this.innerCodeData.length; i++) {
  220. let flag = value.includes(this.innerCodeData[i].inner_code);
  221. if (flag) {
  222. this.innerCodeData[i].checked = true
  223. } else {
  224. this.innerCodeData[i].checked = false
  225. }
  226. }
  227. this.checkedList = this.checkedList.concat(value);
  228. >>>>>>> ec9bba9783fc5bf29c8b3276224b1ab4fab155dc
  229. }
  230. }
  231. }
  232. </script>
  233. <style lang="scss" scoped>
  234. .step_title {
  235. font-size: 30rpx;
  236. font-weight: 600;
  237. }
  238. .card_avatar {
  239. display: flex;
  240. align-items: center;
  241. justify-content: space-between;
  242. }
  243. .mine_image {
  244. width: 100rpx;
  245. height: 100rpx;
  246. border-radius: 50%;
  247. }
  248. .card_user_title {
  249. display: flex;
  250. flex-direction: column;
  251. align-items: flex-start;
  252. }
  253. .mine_phone {
  254. margin-left: 20rpx;
  255. font-size: 30rpx;
  256. }
  257. .card_transfer_details {
  258. border: 1rpx dashed #d7d7d7;
  259. margin-top: 20rpx;
  260. padding: 20rpx;
  261. background-color: #f4f4f5;
  262. }
  263. .item_card_tran {
  264. display: flex;
  265. align-items: center;
  266. justify-content: space-between;
  267. padding: 30rpx 30rpx 30rpx 0rpx;
  268. }
  269. .title_code_a {
  270. font-size: 32rpx;
  271. font-weight: 600;
  272. }
  273. .num_code {
  274. color: #2979ff;
  275. font-size: 28rpx;
  276. }
  277. .btn_transfer_details {
  278. position: fixed;
  279. bottom: 0;
  280. left: 0;
  281. right: 0;
  282. background-color: #fff;
  283. display: flex;
  284. align-items: center;
  285. padding: 20rpx 0rpx;
  286. border-top: 1rpx solid #f4f4f5;
  287. }
  288. <<<<<<< HEAD
  289. .color_blue {
  290. color: #19be6b;
  291. font-size: 26rpx;
  292. }
  293. .color_red {
  294. color: #fa3534;
  295. font-size: 26rpx;
  296. =======
  297. .blue_title {
  298. color: #53c21d;
  299. font-size: 28rpx;
  300. }
  301. .red_title {
  302. color: red;
  303. font-size: 28rpx;
  304. >>>>>>> ec9bba9783fc5bf29c8b3276224b1ab4fab155dc
  305. }
  306. </style>