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

161 lines
3.6 KiB

  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. contents.push(warehouse_list[i]);
  79. }
  80. this.contents = contents;
  81. },
  82. methods: {
  83. // todo table输入框
  84. onInputChange(event){
  85. console.log("检测到table input被更改", event);
  86. // this.contents[event.contentIndex][event.key].value = event.detailValue;
  87. },
  88. // 保存,出库
  89. save(_t){
  90. console.log("dddddd", this.contents)
  91. if(this.contents.length <= 0) {
  92. return this.$msg('您未选择物资')
  93. }
  94. let list = this.contents.map(item => {
  95. return {
  96. m_id: item.material_id,
  97. m_spec_id: item.spec_id,
  98. tax_price: '',
  99. non_tax_price: '',
  100. purchase_id: item.purchase_id,
  101. out_number: ''
  102. }
  103. });
  104. // let state = ['', ''][_t]; // 传入状态
  105. this.$http(this.API.API_CANTEEN_WAREHOUSEOUT, {
  106. data: list
  107. }).then(res => {
  108. console.log("save", res);
  109. this.$msg('操作成功');
  110. })
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped="scoped">
  116. .lf-m-t-5{
  117. margin-top: 5rpx;
  118. }
  119. .lf-icon{
  120. padding: 2rpx 10rpx;
  121. display: flex;
  122. align-items: center;
  123. justify-content: center;
  124. }
  125. .fixed-bottom{
  126. position: fixed;
  127. bottom: 0rpx;
  128. left: 0rpx;
  129. z-index: 99;
  130. width: 750rpx;
  131. height: 98rpx;
  132. display: flex;
  133. justify-content: center;
  134. align-items: center;
  135. border-top: 1rpx solid #E5E5E5;
  136. .btn{
  137. width: 320rpx;
  138. height: 82rpx;
  139. border-radius: 41rpx;
  140. margin: 0;
  141. padding: 0;
  142. font-size: 32rpx;
  143. display: flex;
  144. justify-content: center;
  145. align-items: center;
  146. }
  147. .btn1{
  148. border: 2rpx solid #555555;
  149. opacity: .5;
  150. }
  151. .btn2{
  152. background: #11D189;
  153. color: #FFFFFF;
  154. margin-left: 50rpx;
  155. }
  156. }
  157. </style>