自主产品,供应链食堂系统。将两个端拆开了。
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.

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