自主项目,食堂系统,前端uniapp
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.

141 lines
3.3 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/canteen/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. label: '批次',
  42. key: 'purchase_id'
  43. }],
  44. contents: [],
  45. warehouse_list: {}
  46. }
  47. },
  48. onLoad(){
  49. // 监听warehouse_list被操作
  50. uni.$on('addWarehouseList', res => {
  51. this.warehouse_list = res;
  52. })
  53. },
  54. onShow(){
  55. let contents = [];
  56. let warehouse_list = this.warehouse_list;
  57. for(let i in warehouse_list){
  58. contents.push(warehouse_list[i]);
  59. }
  60. this.contents = contents;
  61. },
  62. methods: {
  63. // todo table输入框
  64. onInputChange(event){
  65. console.log("检测到table input被更改", event);
  66. // this.contents[event.contentIndex][event.key].value = event.detailValue;
  67. },
  68. // 保存,出库
  69. save(_t){
  70. console.log("dddddd", this.contents)
  71. if(this.contents.length <= 0) {
  72. return this.$msg('您未选择物资')
  73. }
  74. let list = this.contents.map(item => {
  75. return {
  76. m_id: item.material_id,
  77. m_spec_id: item.spec_id,
  78. tax_price: '',
  79. non_tax_price: '',
  80. purchase_id: item.purchase_id,
  81. out_number: ''
  82. }
  83. });
  84. // let state = ['', ''][_t]; // 传入状态
  85. this.$http(this.API.API_CANTEEN_WAREHOUSEOUT, {
  86. data: list
  87. }).then(res => {
  88. console.log("save", res);
  89. this.$msg('操作成功');
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped="scoped">
  96. .lf-m-t-5{
  97. margin-top: 5rpx;
  98. }
  99. .lf-icon{
  100. padding: 2rpx 10rpx;
  101. display: flex;
  102. align-items: center;
  103. justify-content: center;
  104. }
  105. .fixed-bottom{
  106. position: fixed;
  107. bottom: 0rpx;
  108. left: 0rpx;
  109. z-index: 99;
  110. width: 750rpx;
  111. height: 98rpx;
  112. display: flex;
  113. justify-content: center;
  114. align-items: center;
  115. border-top: 1rpx solid #E5E5E5;
  116. .btn{
  117. width: 320rpx;
  118. height: 82rpx;
  119. border-radius: 41rpx;
  120. margin: 0;
  121. padding: 0;
  122. font-size: 32rpx;
  123. display: flex;
  124. justify-content: center;
  125. align-items: center;
  126. }
  127. .btn1{
  128. border: 2rpx solid #555555;
  129. opacity: .5;
  130. }
  131. .btn2{
  132. background: #11D189;
  133. color: #FFFFFF;
  134. margin-left: 50rpx;
  135. }
  136. }
  137. </style>