index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view style="background-color: white;">
  3. <scroll-view scroll-y="true" style="height: 100vh;">
  4. <u-collapse ref="collapse" :value="defaultValue">
  5. <u-collapse-item :title="data.factoryName" :value="'库存量:' + data.factoryTotalQty" name="factory">
  6. <view>
  7. <u-collapse
  8. @open="workshopOpen(workshopIndex)"
  9. @close="workshopClose()"
  10. v-for="(workshopItem, workshopIndex) in data.productWorkshops"
  11. :value="workshopOpenIndexs" v-bind:key="workshopIndex"
  12. >
  13. <u-collapse-item :title="workshopItem.workshopName" :value="'库存量:' + workshopItem.workshopQty" ref="collapseItem" :name="workshopIndex">
  14. <view class="cu-list menu">
  15. <view
  16. class="cu-item"
  17. style="margin-top: 10rpx "
  18. v-for="(titem, tindex) in workshopItem.teamStocks"
  19. :class="modalName == 'move-box-' + workshopIndex + tindex ? 'move-cur' : ''"
  20. :key="tindex"
  21. @touchstart="ListTouchStart"
  22. @touchmove="ListTouchMove"
  23. @touchend="ListTouchEnd"
  24. :data-target="'move-box-' + workshopIndex + tindex"
  25. >
  26. <!-- <view class=" radius shadow bg-blue text-gray"> -->
  27. <view class="content">
  28. <view class="cu-form-group">
  29. <view class="title" style="min-width: calc(4em + 15px);">订单号</view>
  30. <text class="text-grey" style="flex: 1;">{{ titem.orderNo }}</text>
  31. </view>
  32. <view class="cu-form-group">
  33. <view class="title" style="min-width: calc(4em + 15px);">制衣班组</view>
  34. <text class="text-grey" style="flex: 1;">{{ titem.teamName }}</text>
  35. <view class="title" style="min-width: calc(3em + 15px);">总库存</view>
  36. <text class="text-grey" style="flex: 1;">{{ titem.teamTotalQty }}</text>
  37. </view>
  38. <view class="cu-form-group">
  39. <view class="title" style="min-width: calc(4em + 15px);">累计领</view>
  40. <text class="text-grey" style="flex: 1;">{{ titem.totalRcvQty }}</text>
  41. <view class="title" style="min-width: calc(3em + 15px);">累计送</view>
  42. <text class="text-grey" style="flex: 1;">{{ titem.totalBackQty }}</text>
  43. </view>
  44. </view>
  45. <view class="move">
  46. <!-- <view class="bg-grey" @click="editPlanInfo(titem)">修改</view> -->
  47. <view class="bg-red" @click="archiveFiling(titem)">封存</view>
  48. </view>
  49. </view>
  50. </view>
  51. </u-collapse-item>
  52. </u-collapse>
  53. </view>
  54. </u-collapse-item>
  55. </u-collapse>
  56. </scroll-view>
  57. </view>
  58. </template>
  59. <script>
  60. import { queryStock, queryStockByWorkshop,archiveFiling } from '@/api/biz/stock.js';
  61. export default {
  62. data() {
  63. return {
  64. data: {},
  65. defaultValue: [],
  66. workshopOpenIndexs: [],
  67. modalName: null,
  68. };
  69. },
  70. methods: {
  71. open(e) {},
  72. // ListTouch触摸开始
  73. ListTouchStart(e) {
  74. this.listTouchStart = e.touches[0].pageX;
  75. },
  76. // ListTouch计算方向
  77. ListTouchMove(e) {
  78. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > 0 ? 'right' : 'left';
  79. },
  80. // ListTouch计算滚动
  81. ListTouchEnd(e) {
  82. if (this.listTouchDirection == 'left') {
  83. this.modalName = e.currentTarget.dataset.target;
  84. } else {
  85. this.modalName = null;
  86. }
  87. this.listTouchDirection = null;
  88. },
  89. workshopOpen(index) {
  90. this.defaultValue = ['factory'];
  91. this.$nextTick(() => {
  92. setTimeout(() => {
  93. this.$refs.collapse.init();
  94. }, 1000);
  95. });
  96. },
  97. workshopClose() {
  98. this.defaultValue = ['factory'];
  99. this.$nextTick(() => {
  100. setTimeout(() => {
  101. this.$refs.collapse.init();
  102. }, 1000);
  103. });
  104. },
  105. archiveFiling(item) {
  106. console.log(item);
  107. // const arr = []
  108. // arr.push(item)
  109. archiveFiling(item).then(res => {
  110. if (res.success) {
  111. console.log(this.data)
  112. console.log(item)
  113. this.removeFilingInfo(item)
  114. }else{
  115. this.$refs.uToast.show({
  116. type: 'error',
  117. message: res.message,
  118. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  119. })
  120. }
  121. })
  122. },
  123. removeFilingInfo(item) {
  124. console.log("data=="+this.data.productWorkshops);
  125. for (let item2 in this.data.productWorkshops) {
  126. console.log("==="+this.data.productWorkshops[item2].teamStocks);
  127. for (let item3 in this.data.productWorkshops[item2].teamStocks) {
  128. console.log("222====="+this.data.productWorkshops[item2].teamStocks[item3]);
  129. console.log("333====="+this.data.productWorkshops[item2].teamStocks[item3].orderNo);
  130. const index = this.data.productWorkshops[item2].teamStocks.findIndex(ele => {
  131. return ele.orderNo == item.orderNo
  132. })
  133. this.data.productWorkshops[item2].teamStocks.splice(index, 1)
  134. // for (let item2 of productWorkshop[item]) {
  135. // console.log("====="+item2);
  136. // }
  137. }
  138. // totalPrice += item.price * item.count;
  139. }
  140. // const index = this.productWorkshops.findIndex(ele => {
  141. // return ele.id == item.id
  142. // })
  143. // this.filingList.splice(index, 1)
  144. },
  145. // workshopClose(workshopIndex) {
  146. // const index = this.workshopOpenIndexs.indexOf(workshopIndex)
  147. // this.workshopOpenIndexs.splice(0, 1)
  148. // this.$refs.collapse.init()
  149. // },
  150. // workshopOpen(workshopItem, index) {
  151. // this.defaultValue = ['factory']
  152. // this.workshopOpenIndexs.push(index)
  153. // this.getDataByWorkshop(workshopItem, index)
  154. // },
  155. // getDataByWorkshop(workshopItem, index) {
  156. // queryStockByWorkshop(workshopItem.workshopName).then(res => {
  157. // if (res.success) {
  158. // workshopItem["teamStocks"] = res.data
  159. // this.$nextTick(() => {
  160. // setTimeout(() => {
  161. // this.$refs.collapseItem[index].init()
  162. // this.$nextTick(() => {
  163. // setTimeout(() => {
  164. // this.$refs.collapse.init()
  165. // }, 500)
  166. // })
  167. // }, 500)
  168. // })
  169. // }
  170. // })
  171. // },
  172. loadInitData() {
  173. queryStock().then(res => {
  174. if (res.success) {
  175. console.log(res.data)
  176. this.data = res.data;
  177. }
  178. });
  179. }
  180. },
  181. onReady() {
  182. this.loadInitData();
  183. }
  184. };
  185. </script>
  186. <style>
  187. .cu-form-group {
  188. min-height: 0;
  189. border: none !important;
  190. }
  191. </style>