自主产品,供应链食堂系统。将两个端拆开了。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
3.9 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <view class="lf-p-32 lf-p-t-30 lf-p-b-30 lf-w-100 lf-h-maxcontent lf-border-box">
  4. <view class="lf-font-28 lf-color-black lf-row-between">
  5. <view>出库清单</view>
  6. <view class="lf-icon" @click="$url('/pages/classification/warehouse')">
  7. <u-icon name="plus-circle" size="42"></u-icon>
  8. </view>
  9. </view>
  10. <view class="lf-font-24 lf-color-gray lf-m-t-5">添加物资后可以编辑数量</view>
  11. </view>
  12. <!-- 修饰条 -->
  13. <self-line></self-line>
  14. <!-- 物料table -->
  15. <view class="lf-p-32 lf-p-t-30 lf-p-b-30 lf-w-100 lf-h-maxcontent lf-border-box">
  16. <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
  17. <wyb-table :headers="headers" :contents="contents"
  18. contentBgColor="#ecfaf5"
  19. :first-line-fixed="true"
  20. @onInputChange="onInputChange"
  21. width="max-content" height="800rpx"
  22. v-if="contents.length"></wyb-table>
  23. </view>
  24. <!-- 操作按钮 -->
  25. <view class="fixed-bottom">
  26. <button class="btn btn1" @click="save(0)">临时保存</button>
  27. <button class="btn btn2" @click="save(1)">直接申请</button>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import wybTable from '@/components/wyb-table/wyb-table';
  33. export default {
  34. components: {
  35. wybTable
  36. },
  37. data(){
  38. return {
  39. headers: [{
  40. label: '物资名称',
  41. key: 'material_name'
  42. },{
  43. label: '规格',
  44. key: 'spec_name'
  45. },{
  46. key: 'brand',
  47. label: '品牌'
  48. },{
  49. key: 'quality_level',
  50. label: '品级'
  51. },{
  52. label: '编号',
  53. key: 'm_sn'
  54. },{
  55. label: '供应商',
  56. key: 'supplier_name'
  57. },{
  58. label: '批次',
  59. key: 'purchase_id'
  60. },{
  61. key: 'delivery_number',
  62. label: '出库数量'
  63. }],
  64. contents: [],
  65. warehouse_list: {}
  66. }
  67. },
  68. onLoad(){
  69. // 监听warehouse_list被操作
  70. uni.$on('addWarehouseList', res => {
  71. this.warehouse_list = res;
  72. })
  73. },
  74. onShow(){
  75. let contents = [];
  76. let warehouse_list = this.warehouse_list;
  77. for(let i in warehouse_list){
  78. warehouse_list[i].delivery_number = {edit: true, value: '1'}
  79. warehouse_list[i].brand = i.brand
  80. warehouse_list[i].quality_level = i.quality_level
  81. contents.push(warehouse_list[i]);
  82. }
  83. this.contents = contents;
  84. },
  85. methods: {
  86. // todo table输入框
  87. onInputChange(event){
  88. console.log("检测到table input被更改", event);
  89. // this.contents[event.contentIndex][event.key].value = event.detailValue;
  90. },
  91. // 保存,出库
  92. save(_t){
  93. console.log("dddddd", this.contents)
  94. if(this.contents.length <= 0) {
  95. return this.$msg('您未选择物资')
  96. }
  97. let list = this.contents.map(item => {
  98. console.log(item)
  99. return {
  100. m_id: item.material_id,
  101. m_spec_id: item.spec_id,
  102. tax_price: '',
  103. non_tax_price: '',
  104. purchase_id: item.purchase_id,
  105. out_number: '' ,
  106. state: '待确认'
  107. }
  108. });
  109. this.contents = list;
  110. console.log('==========',list)
  111. // let state = ['', ''][_t]; // 传入状态
  112. this.$http(this.API.API_CANTEEN_WAREHOUSEOUT, {
  113. data: list
  114. }).then(res => {
  115. console.log("save", res);
  116. this.$msg('操作成功');
  117. })
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss" scoped="scoped">
  123. .lf-m-t-5{
  124. margin-top: 5rpx;
  125. }
  126. .lf-icon{
  127. padding: 2rpx 10rpx;
  128. display: flex;
  129. align-items: center;
  130. justify-content: center;
  131. }
  132. .fixed-bottom{
  133. position: fixed;
  134. bottom: 0rpx;
  135. left: 0rpx;
  136. z-index: 99;
  137. width: 750rpx;
  138. height: 98rpx;
  139. display: flex;
  140. justify-content: center;
  141. align-items: center;
  142. border-top: 1rpx solid #E5E5E5;
  143. .btn{
  144. width: 320rpx;
  145. height: 82rpx;
  146. border-radius: 41rpx;
  147. margin: 0;
  148. padding: 0;
  149. font-size: 32rpx;
  150. display: flex;
  151. justify-content: center;
  152. align-items: center;
  153. }
  154. .btn1{
  155. border: 2rpx solid #555555;
  156. opacity: .5;
  157. }
  158. .btn2{
  159. background: #11D189;
  160. color: #FFFFFF;
  161. margin-left: 50rpx;
  162. }
  163. }
  164. </style>