goodDetail.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <div style="width: 100%">
  3. <Modal v-model="modals" scrollable footer-hide closable title="商品列表" :mask-closable="false" width="700">
  4. <Form ref="formValidate" :label-width="labelWidth" :label-position="labelPosition" class="tabform"
  5. @submit.native.prevent>
  6. <Row :gutter="24" type="flex">
  7. <Col span="12">
  8. <FormItem label="关键字:">
  9. <Input enter-button placeholder="请输入商品名称" element-id="name" v-model="formValidate.key" clearable />
  10. </FormItem>
  11. </Col>
  12. <Col span="4">
  13. <Button type="primary" icon="ios-search" @click="userSearchs">搜索</Button>
  14. </Col>
  15. </Row>
  16. </Form>
  17. <!-- <Divider dashed/> -->
  18. <Table :columns="columns" :data="tabList" ref="table" :loading="loading" no-userFrom-text="暂无数据"
  19. no-filtered-userFrom-text="暂无筛选结果" class="table" @on-selection-change="change">
  20. <template slot-scope="{ row, index }" slot="store">
  21. <span> {{ row.my.stock }}{{row.my.unit_name}}</span>
  22. </template>
  23. <!-- product_num -->
  24. <template slot-scope="{ row, index }" slot="product_num">
  25. <span> {{ row.product_num }}{{row.unit_name || row.info['unit_name' + (row.unit_type == 0 ? '':(row.unit_type == 1?"_1":"_2"))]}}</span>
  26. </template>
  27. </Table>
  28. <div class="acea-row row-right page">
  29. <Page :total="total" :current="formValidate.page" show-elevator show-total @on-change="pageChange"
  30. :page-size="formValidate.limit" />
  31. </div>
  32. <Button type="primary" @click="ok" style="width: 100%;margin-top:20px;">确认</Button>
  33. </Modal>
  34. </div>
  35. </template>
  36. <script>
  37. import {
  38. commissionDetailApi,
  39. extractlistApi
  40. } from '@/api/finance';
  41. import {
  42. getGodownList,
  43. createGodown,
  44. getGodownInfo,
  45. getUserList,
  46. getOutGoods,
  47. getGoods
  48. } from "@/api/erp";
  49. import {
  50. mapState
  51. } from 'vuex';
  52. export default {
  53. name: 'commissionDetails',
  54. data() {
  55. return {
  56. chooseGoods:[],
  57. key: '',
  58. wid: '',
  59. my_store_id: '',
  60. store_id: 0,
  61. type: 0,
  62. modals: false,
  63. spinShow: false,
  64. detailsData: {},
  65. Ids: 0,
  66. loading: false,
  67. formValidate: {
  68. page: 1, // 当前页
  69. limit: 10 ,// 每页显示条数
  70. key: '',
  71. wid: '',
  72. my_store_id: '',
  73. store_id: 0,
  74. who: 0,
  75. },
  76. total: 0,
  77. columns: [{
  78. type: 'selection',
  79. width: 60,
  80. align: 'center'
  81. },
  82. {
  83. title: 'ID',
  84. key: 'product_id',
  85. minWidth: 50
  86. },
  87. {
  88. title: '商品名称',
  89. key: 'store_name',
  90. minWidth: 200
  91. },
  92. {
  93. title: '仓库库存',
  94. slot: 'product_num',
  95. minWidth: 150
  96. },
  97. {
  98. title: '门店库存',
  99. key: 'stock',
  100. minWidth: 330
  101. }
  102. ],
  103. tabList: []
  104. }
  105. },
  106. computed: {
  107. ...mapState('admin/layout', [
  108. 'isMobile'
  109. ]),
  110. labelWidth() {
  111. return this.isMobile ? undefined : 80;
  112. },
  113. labelPosition() {
  114. return this.isMobile ? 'top' : 'left';
  115. }
  116. },
  117. mounted() {
  118. // if (this.Ids) {
  119. // this.getList();
  120. // }
  121. this.chooseGoods = []
  122. },
  123. methods: {
  124. clearChoose() {
  125. this.chooseGoods = []
  126. this.$refs.table.selectAll(false);
  127. },
  128. change(e) {
  129. this.chooseGoods = e
  130. },
  131. ok() {
  132. this.modals = false;
  133. this.$emit('setGoods',this.chooseGoods);
  134. },
  135. // 时间
  136. onchangeTime(e) {
  137. this.formValidate.start_time = e[0];
  138. this.formValidate.end_time = e[1];
  139. },
  140. // 详情
  141. getDetails(id) {
  142. this.Ids = id;
  143. this.spinShow = true;
  144. commissionDetailApi(id).then(async res => {
  145. if (res.status === 200) {
  146. let data = res.data
  147. this.detailsData = data.user_info;
  148. this.spinShow = false;
  149. } else {
  150. this.spinShow = false;
  151. this.$Message.error(res.msg);
  152. }
  153. }).catch(res => {
  154. this.spinShow = false;
  155. this.$Message.error(res.msg);
  156. })
  157. },
  158. // 列表
  159. getList() {
  160. let getList;
  161. if (this.formValidate.who == 1) {
  162. this.formValidate.wid = ''
  163. } else {
  164. this.formValidate.store_id = 0
  165. getList = getGoods
  166. }
  167. if(this.formValidate.key == '') {
  168. return this.$Message.error('请输入关键字')
  169. }
  170. this.loading = true;
  171. getList(this.formValidate).then(async res => {
  172. let data = res.data;
  173. this.tabList = data.data;
  174. this.total = data.count;
  175. this.loading = false;
  176. }).catch(res => {
  177. this.loading = false;
  178. this.$Message.error(res.msg);
  179. })
  180. },
  181. pageChange(index) {
  182. this.formValidate.page = index
  183. this.getList();
  184. },
  185. // 搜索
  186. userSearchs() {
  187. this.formValidate.page = 1;
  188. this.getList();
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="less" scoped>
  194. .table {
  195. .ivu-table-default {
  196. overflow-y: auto;
  197. max-height: 350px;
  198. }
  199. }
  200. .dashboard-workplace {
  201. &-header {
  202. &-avatar {
  203. width: 64px;
  204. height: 64px;
  205. border-radius: 50%;
  206. margin-right: 16px;
  207. font-weight: 600;
  208. }
  209. &-tip {
  210. width: 82%;
  211. display: inline-block;
  212. vertical-align: middle;
  213. &-title {
  214. font-size: 13px;
  215. color: #000000;
  216. margin-bottom: 12px;
  217. }
  218. &-desc {
  219. &-sp {
  220. width: 33.33%;
  221. color: #17233D;
  222. font-size: 12px;
  223. display: inline-block;
  224. }
  225. }
  226. }
  227. &-extra {
  228. .ivu-col {
  229. p {
  230. text-align: right;
  231. }
  232. p:first-child {
  233. span:first-child {
  234. margin-right: 4px;
  235. }
  236. span:last-child {
  237. color: #808695;
  238. }
  239. }
  240. p:last-child {
  241. font-size: 22px;
  242. }
  243. }
  244. }
  245. }
  246. }
  247. </style>