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

213 lines
5.2 KiB

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 lf-p-l-32 lf-p-r-32" style="justify-content: space-between;" v-if="enter_type == 1">
  26. <view></view>
  27. <button class="btn btn2" @click="editOrder()">立即申请</button>
  28. </view>
  29. <view class="fixed-bottom" v-else>
  30. <button class="btn btn1" @click="save(0)">临时保存</button>
  31. <button class="btn btn2" @click="save(1)">直接申请</button>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import wybTable from '@/components/wyb-table/wyb-table';
  37. export default {
  38. components: {
  39. wybTable
  40. },
  41. data(){
  42. return {
  43. headers: [{
  44. label: '物资名称',
  45. key: 'material_name'
  46. },{
  47. label: '规格',
  48. key: 'spec_name'
  49. },{
  50. key: 'brand',
  51. label: '品牌'
  52. },{
  53. key: 'quality_level',
  54. label: '品级'
  55. },{
  56. label: '编号',
  57. key: 'm_sn'
  58. },{
  59. label: '供应商',
  60. key: 'supplier_name'
  61. },{
  62. label: '批次',
  63. key: 'purchase_id'
  64. },{
  65. key: 'delivery_number',
  66. label: '出库数量'
  67. }],
  68. contents: [],
  69. warehouse_list: {},
  70. enter_type: '',
  71. o_sn: ''
  72. }
  73. },
  74. onLoad(e){
  75. this.o_sn = e.o_sn
  76. this.enter_type = e.enter_type
  77. // 监听warehouse_list被操作
  78. uni.$on('addWarehouseList', res => {
  79. this.warehouse_list = res;
  80. console.log(this.warehouse_list)
  81. })
  82. },
  83. onShow(e){
  84. if(this.enter_type == 1 || this.enter_type == 2) {
  85. this.getData()
  86. }else {
  87. let contents = [];
  88. let warehouse_list = this.warehouse_list;
  89. for(let i in warehouse_list){
  90. warehouse_list[i].delivery_number = {edit: true, value: '1'}
  91. warehouse_list[i].brand = i.brand
  92. warehouse_list[i].quality_level = i.quality_level
  93. contents.push(warehouse_list[i]);
  94. }
  95. this.contents = contents;
  96. }
  97. },
  98. methods: {
  99. getData(){
  100. this.$http(this.API.API_CANTEEN_OUTDETAIL, {
  101. o_sn: this.o_sn
  102. }).then(res => {
  103. let list = res.data.sheet || [];
  104. let contents = list.map(item => {
  105. return {
  106. material_name: item.material.m_name,
  107. spec_name: item.spec.name,
  108. brand: item.material.brand,
  109. quality_level: item.material.quality_level,
  110. m_sn: item.material.m_sn,
  111. supplier_name: item.purchase.supplier.supplier_name,
  112. purchase_id: item.purchase_id,
  113. delivery_number: {edit: true, value: item.out_number},
  114. order_id: item.material.id
  115. }
  116. })
  117. console.log(contents)
  118. this.contents = contents;
  119. this.warehouse_list = contents
  120. })
  121. },
  122. //编辑出库
  123. editOrder() {
  124. this.$http(this.API.API_EDITOUTORDER, {
  125. data: list
  126. }).then(res => {
  127. console.log("save", res);
  128. this.$msg('操作成功');
  129. })
  130. },
  131. // todo table输入框
  132. onInputChange(event){
  133. console.log("检测到table input被更改", event);
  134. // this.contents[event.contentIndex][event.key].value = event.detailValue;
  135. },
  136. // 保存,出库
  137. save(_t){
  138. console.log("dddddd", this.contents)
  139. if(this.contents.length <= 0) {
  140. return this.$msg('您未选择物资')
  141. }
  142. let list = this.contents.map(item => {
  143. console.log(item)
  144. return {
  145. m_id: item.material_id,
  146. m_spec_id: item.spec_id,
  147. tax_price: '',
  148. non_tax_price: '',
  149. purchase_id: item.purchase_id,
  150. out_number: '' ,
  151. state: '待确认'
  152. }
  153. });
  154. this.contents = list;
  155. console.log('==========',list)
  156. // let state = ['', ''][_t]; // 传入状态
  157. this.$http(this.API.API_CANTEEN_WAREHOUSEOUT, {
  158. data: list
  159. }).then(res => {
  160. console.log("save", res);
  161. this.$msg('操作成功');
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped="scoped">
  168. .lf-m-t-5{
  169. margin-top: 5rpx;
  170. }
  171. .lf-icon{
  172. padding: 2rpx 10rpx;
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. }
  177. .fixed-bottom{
  178. position: fixed;
  179. bottom: 0rpx;
  180. left: 0rpx;
  181. z-index: 99;
  182. width: 750rpx;
  183. height: 98rpx;
  184. display: flex;
  185. justify-content: center;
  186. align-items: center;
  187. border-top: 1rpx solid #E5E5E5;
  188. .btn{
  189. width: 320rpx;
  190. height: 82rpx;
  191. border-radius: 41rpx;
  192. margin: 0;
  193. padding: 0;
  194. font-size: 32rpx;
  195. display: flex;
  196. justify-content: center;
  197. align-items: center;
  198. }
  199. .btn1{
  200. border: 2rpx solid #555555;
  201. opacity: .5;
  202. }
  203. .btn2{
  204. background: #11D189;
  205. color: #FFFFFF;
  206. margin-left: 50rpx;
  207. }
  208. }
  209. </style>