purchase-llist.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <el-page-header @back="onCancel"
  5. :content="`【${goodsName}】进货清单`"></el-page-header>
  6. </h2>
  7. <div class="m-core">
  8. <el-button v-permission="'goods/addGoodsProcurement'"
  9. type="primary"
  10. @click="editVisible = true">新增</el-button>
  11. <save-form inline
  12. class="searchForm"
  13. :model="searchForm"
  14. @submit="search"
  15. @reset="onReSet"
  16. style="margin-top: 20px">
  17. <el-form-item>
  18. <el-input clearable
  19. v-model="searchForm.search"
  20. placeholder="备查货号" />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-date-picker style="width:410px;"
  24. v-model.trim="orderDate"
  25. type="daterange"
  26. value-format="yyyy-MM-dd"
  27. @change="searchOrderDate"
  28. range-separator="至"
  29. start-placeholder="开始日期"
  30. end-placeholder="结束日期"
  31. :picker-options="{ firstDayOfWeek: 1 }">
  32. </el-date-picker>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button native-type="submit" type="danger">搜索</el-button>
  36. <el-button native-type="reset" type="primary">重置</el-button>
  37. </el-form-item>
  38. </save-form>
  39. <div class="tableWrap">
  40. <el-table :data="tableList"
  41. style="width: 100%"
  42. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  43. <el-table-column align='center'
  44. width="180"
  45. prop="batchNo"
  46. label="批次号" />
  47. <el-table-column align='center'
  48. width="150"
  49. prop="supplyChannel"
  50. label="备查货号" />
  51. <el-table-column align='center'
  52. width="150"
  53. prop="stockCount"
  54. label="内部库存" />
  55. <el-table-column align='center'
  56. width="150"
  57. prop="stockSoldNum"
  58. label="内部售出数量" />
  59. <el-table-column align='center'
  60. width="150"
  61. prop="taxStockCount"
  62. label="税务库存" />
  63. <el-table-column align='center'
  64. width="150"
  65. prop="taxStockSoldNum"
  66. label="税务售出数量" />
  67. <el-table-column align='center'
  68. width="150"
  69. prop="discountPrice"
  70. label="商品采购价1" />
  71. <el-table-column align='center'
  72. width="150"
  73. prop="agreeCostPrice"
  74. label="商品采购价2" />
  75. <el-table-column align='center'
  76. prop="createTime"
  77. label="入库日期" />
  78. <!-- <el-table-column
  79. align='center'
  80. width="150"
  81. fixed="right"
  82. label="操作"
  83. >
  84. <template slot-scope="scope">
  85. <el-button
  86. v-permission="'sellOrder/update'"
  87. type="text"
  88. >修改</el-button>
  89. <el-button
  90. @click="edit(scope.row)"
  91. v-permission="'sellOrder/update'"
  92. type="text"
  93. >删除</el-button>
  94. </template>
  95. </el-table-column> -->
  96. </el-table>
  97. </div>
  98. </div>
  99. <el-dialog title="新增进货清单"
  100. width="500px"
  101. :visible.sync="editVisible"
  102. @close="editVisible = false"
  103. destroy-on-close>
  104. <purchaseForm @submited="getList"
  105. @close="closeEdit"
  106. :goodsId="goodsId" />
  107. </el-dialog>
  108. </div>
  109. </template>
  110. <script>
  111. import dayjs from 'dayjs'
  112. import purchaseForm from './purchase-form'
  113. import { getGoodsProcurements } from '@/api/businessManager'
  114. const initSearchForm = {
  115. enterStorageStartTime: null,
  116. enterStorageEndTime: null,
  117. search: '',
  118. }
  119. export default {
  120. components: {
  121. purchaseForm
  122. },
  123. data () {
  124. let query = this.$route.query
  125. return {
  126. goodsName: query.name,
  127. goodsId: query.goodsId,
  128. tableList: [],
  129. detail: null,
  130. editVisible: false,
  131. searchForm: {
  132. ...initSearchForm,
  133. },
  134. pageInfo: {
  135. // 分页规则
  136. limit: 10, // 限制显示条数
  137. page: 1, // 当前页
  138. total: 0, // 总条数
  139. page_size: [10, 20, 40, 50] // 选择限制显示条数
  140. },
  141. orderDate: []
  142. }
  143. },
  144. mounted () {
  145. this.init()
  146. },
  147. methods: {
  148. init () {
  149. const searchForm = this.searchForm
  150. // 判断是否在默认值
  151. if(!searchForm.enterStorageStartTime) {
  152. this.orderDate = [
  153. dayjs().format('YYYY-MM-DD'),
  154. dayjs().format('YYYY-MM-DD'),
  155. ]
  156. searchForm.enterStorageStartTime = this.orderDate[0]
  157. searchForm.enterStorageEndTime = this.orderDate[1]
  158. } else {
  159. this.orderDate = [
  160. searchForm.enterStorageStartTime,
  161. searchForm.enterStorageEndTime
  162. ]
  163. }
  164. let query = this.$route.query
  165. this.goodsId = query.goodsId
  166. this.goodsName = query.name
  167. this.getList()
  168. },
  169. searchOrderDate (val) {
  170. this.searchForm.enterStorageStartTime = (val ? val[0] : '')
  171. this.searchForm.enterStorageEndTime = (val ? val[1] : '')
  172. },
  173. getList () {
  174. const form = {
  175. ...this.searchForm,
  176. goodsId: this.goodsId
  177. }
  178. getGoodsProcurements({
  179. rows: this.pageInfo.limit,
  180. page: this.pageInfo.page,
  181. ...form
  182. })
  183. .then(res => {
  184. if (res.code == 200 && res.data) {
  185. this.tableList = res.data.rows
  186. this.pageInfo.total = res.data.total
  187. }
  188. })
  189. },
  190. onCancel () {
  191. this.$store.dispatch('delVisitedViews', this.$route)
  192. this.$router.push({
  193. path: '/shopManager/shopManager'
  194. })
  195. },
  196. onReSet () {
  197. this.orderDate = []
  198. this.searchForm = {
  199. ...initSearchForm,
  200. }
  201. this.getList()
  202. },
  203. edit (row) {
  204. this.editVisible = true
  205. this.detail = row
  206. },
  207. closeEdit () {
  208. this.editVisible = false
  209. this.detail = null
  210. },
  211. search () {
  212. this.getList()
  213. },
  214. },
  215. }
  216. </script>
  217. <style lang="less" scoped>
  218. </style>