stocktaking.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <!-- 营销-积分商品 -->
  3. <div>
  4. <Card :bordered="false" dis-hover class="ivu-mt" :padding="0">
  5. <div class="new_card_pd">
  6. <!-- 查询条件 -->
  7. <Form ref="tableFrom" inline :model="tableFrom" :label-width="labelWidth"
  8. :label-position="labelPosition" @submit.native.prevent>
  9. <FormItem label="仓库:" prop="pid" label-for="pid">
  10. <Select v-model="tableFrom.wid" @on-change="userSearchs" clearable class="input-add">
  11. <Option v-for="item in data1" :value="item.id" :key="item.id">
  12. {{ item.title }}
  13. </Option>
  14. </Select>
  15. </FormItem>
  16. </Form>
  17. </div>
  18. </Card>
  19. <Card :bordered="false" dis-hover class="ivu-mt">
  20. <!-- 操作 -->
  21. <Button v-auth="['admin-erp-stocktaking_add']" type="primary" @click="add" class="mr10">添加盘点单</Button>
  22. <!-- 积分商品-表格 -->
  23. <Table :columns="columns1" :data="tableList" :loading="loading" highlight-row no-userFrom-text="暂无数据"
  24. no-filtered-userFrom-text="暂无筛选结果" class="ivu-mt">
  25. <template slot-scope="{ row, index }" slot="passageway">
  26. <span> {{ row.bin_number.slice(0,2) }}</span>
  27. </template>
  28. <template slot-scope="{ row, index }" slot="control">
  29. <span> {{ row.bin_number.slice(2,3) }}</span>
  30. </template>
  31. <template slot-scope="{ row, index }" slot="num">
  32. <span> {{ row.body.length }}</span>
  33. </template>
  34. <template slot-scope="{ row, index }" slot="add_time">
  35. <span> {{ row.add_time |formatDate }}</span>
  36. </template>
  37. <template slot-scope="{ row, index }" slot="ware">
  38. <div>名称:{{row.ware.title}}</div>
  39. <div>ID:{{row.ware.id}}</div>
  40. <div>手机:{{row.ware.phone}}</div>
  41. <div>地址:{{row.ware.detailed_address}}</div>
  42. </template>
  43. <template slot-scope="{ row, index }" slot="status">
  44. <Tag color="default" v-if="row.status == 0">待审核</Tag>
  45. <Tag color="primary" v-if="row.status == 1">通过</Tag>
  46. <Tag color="error" v-if="row.status == -1">拒绝</Tag>
  47. </template>
  48. <template slot-scope="{ row, index }" slot="action">
  49. <a @click="look(row)">详情</a>
  50. <template v-if="row.status == 0">
  51. <Divider type="vertical" />
  52. <a @click="pass(row)">审核</a>
  53. </template>
  54. <!-- <a @click="del(row, '删除仓位', index)">删除</a> -->
  55. </template>
  56. </Table>
  57. <div class="acea-row row-right page">
  58. <Page :total="total" :current="tableFrom.page" show-elevator show-total @on-change="pageChange"
  59. :page-size="tableFrom.limit" />
  60. </div>
  61. </Card>
  62. <Modal
  63. v-model="modalpass"
  64. scrollable
  65. title="审核"
  66. class="order_box"
  67. :closable="false"
  68. :mask-closable="false"
  69. >
  70. <Form
  71. ref="remarks"
  72. :model="remarks"
  73. :label-width="80"
  74. @submit.native.prevent
  75. >
  76. <FormItem label="审核人:">
  77. <Select v-model="remarks.auth_uid" clearable filterable @on-change="userSearchse"
  78. class="input-add">
  79. <Option v-for="item in authLists" :value="item.id" :key="item.id">{{ item.staff_name }}
  80. </Option>
  81. </Select>
  82. </FormItem>
  83. <FormItem label="状态:">
  84. <Select v-model="remarks.status" clearable filterable
  85. class="input-add">
  86. <Option :value="1" >通过</Option>
  87. <Option :value="-1" >拒绝</Option>
  88. <!-- <Option :value="2" >部分完成</Option>
  89. <Option :value="3" >完成</Option>
  90. <Option :value="-2" >无效</Option> -->
  91. </Select>
  92. </FormItem>
  93. <FormItem label="备注:">
  94. <Input
  95. v-model="remarks.auth_remark"
  96. maxlength="200"
  97. show-word-limit
  98. type="textarea"
  99. placeholder="请填写备注~"
  100. style="width: 100%"
  101. />
  102. </FormItem>
  103. </Form>
  104. <div slot="footer">
  105. <Button type="primary" @click="putRemark()">提交</Button>
  106. <Button @click="cancel()">取消</Button>
  107. </div>
  108. </Modal>
  109. <stocktakingDetail ref="stocktakingDetail"></stocktakingDetail>
  110. </div>
  111. </template>
  112. <script>
  113. import stocktakingDetail from './stocktakingDetail.vue'
  114. import {
  115. mapState
  116. } from "vuex";
  117. import {
  118. integralProductListApi,
  119. integralIsShowApi,
  120. storeSeckillApi,
  121. } from "@/api/marketing";
  122. import {
  123. getPositionList,
  124. getUserInfo,
  125. getInventoryList,
  126. getGodownList,
  127. getUserList,
  128. authInventory,
  129. } from "@/api/erp";
  130. import {
  131. formatDate
  132. } from "@/utils/validate";
  133. import timeOptions from "@/utils/timeOptions";
  134. import Setting from "@/setting";
  135. export default {
  136. name: "stocktaking",
  137. components: {
  138. stocktakingDetail
  139. },
  140. filters: {
  141. formatDate(time) {
  142. if (time !== 0) {
  143. let date = new Date(time * 1000);
  144. return formatDate(date, "yyyy-MM-dd");
  145. }
  146. },
  147. },
  148. data() {
  149. return {
  150. modalpass:false,
  151. authLists: [],//审核员列表
  152. remarks: {
  153. id: 0,
  154. status: '',
  155. auth_uid: "",
  156. auth_admin_id: "",
  157. auth_remark: '',
  158. },
  159. data1: [],//仓库列表
  160. roterPre: Setting.roterPre,
  161. loading: false,
  162. options: timeOptions,
  163. columns1: [{
  164. title: "ID",
  165. key: "id",
  166. width: 80,
  167. },
  168. {
  169. title: "订单编号",
  170. key: "order_id",
  171. minWidth: 90,
  172. },
  173. {
  174. title: "商品数量",
  175. slot: "num",
  176. minWidth: 90,
  177. },
  178. {
  179. title: "所属仓库",
  180. slot: "ware",
  181. minWidth: 90,
  182. },
  183. {
  184. title: "盘点时间",
  185. slot: "add_time",
  186. minWidth: 90,
  187. },
  188. {
  189. title: "状态",
  190. slot: "status",
  191. minWidth: 90,
  192. },
  193. {
  194. title: "备注",
  195. key: "auth_remark",
  196. minWidth: 90,
  197. },
  198. {
  199. title: "操作",
  200. slot: "action",
  201. fixed: "right",
  202. width: 200,
  203. },
  204. ],
  205. tableList: [],
  206. timeVal: [],
  207. grid: {
  208. xl: 7,
  209. lg: 10,
  210. md: 12,
  211. sm: 24,
  212. xs: 24,
  213. },
  214. tableFrom: {
  215. // integral_time: "",
  216. // is_show: "",
  217. // store_name: "",
  218. wid: '',
  219. key: '',
  220. page: 1,
  221. limit: 10,
  222. },
  223. total: 0,
  224. };
  225. },
  226. computed: {
  227. ...mapState("admin/layout", ["isMobile"]),
  228. labelWidth() {
  229. return this.isMobile ? undefined : 96;
  230. },
  231. labelPosition() {
  232. return this.isMobile ? "top" : "right";
  233. },
  234. },
  235. created() {
  236. this.getGodownList()
  237. this.getList();
  238. },
  239. methods: {
  240. look(row) {
  241. this.$refs.stocktakingDetail.getInfo(row.id);
  242. },
  243. putRemark() {
  244. authInventory(this.remarks).then(res => {
  245. this.cancel()
  246. this.getList();
  247. })
  248. },
  249. cancel() {
  250. this.remarks = {
  251. id:0,
  252. status: '',
  253. auth_uid: "",
  254. auth_admin_id: "",}
  255. this.modalpass = false
  256. },
  257. userSearchse(e) {
  258. let auth = this.authLists.find(item => item.id == e)
  259. this.remarks.auth_admin_id = auth.admin_id
  260. },
  261. //审核
  262. pass(row) {
  263. this.remarks.id = row.id
  264. getUserList({
  265. wid: row.wid
  266. }).then(res => {
  267. this.authLists = res.data.data
  268. this.modalpass = true;
  269. })
  270. },
  271. userSearchs(e) {
  272. this.tableFrom.page = 1;
  273. this.getList();
  274. },
  275. getGodownList() {
  276. getGodownList().then(res => {
  277. console.log(res);
  278. this.data1 = res.data.data
  279. })
  280. },
  281. // 添加
  282. add() {
  283. this.$router.push({
  284. path: this.roterPre + "/erp/stocktaking_add?id=0"
  285. });
  286. },
  287. addMore() {
  288. this.$router.push({
  289. path: this.roterPre + "/marketing/store_integral/add_store_integral",
  290. });
  291. },
  292. orderList(row) {
  293. this.$router.push({
  294. path: this.roterPre + "/marketing/store_integral/order_list",
  295. query: {
  296. product_id: row.id,
  297. },
  298. });
  299. },
  300. // 导出
  301. exports() {
  302. let formValidate = this.tableFrom;
  303. let data = {
  304. start_status: formValidate.start_status,
  305. status: formValidate.status,
  306. store_name: formValidate.store_name,
  307. };
  308. storeSeckillApi(data)
  309. .then((res) => {
  310. location.href = res.data[0];
  311. })
  312. .catch((res) => {
  313. this.$Message.error(res.msg);
  314. });
  315. },
  316. // 编辑
  317. edit(row) {
  318. this.$router.push({
  319. path: this.roterPre + "/erp/add_position?id=" + row.id
  320. });
  321. },
  322. // 一键复制
  323. copy(row) {
  324. this.$router.push({
  325. path: this.roterPre + "/marketing/store_integral/create/" + row.id + "/1",
  326. });
  327. },
  328. // 删除
  329. del(row, tit, num) {
  330. let delfromData = {
  331. title: tit,
  332. num: num,
  333. url: `/erp/Warehouse/position_del/${row.id}`,
  334. method: "DELETE",
  335. ids: "",
  336. };
  337. this.$modalSure(delfromData)
  338. .then((res) => {
  339. this.$Message.success(res.msg);
  340. this.tableList.splice(num, 1);
  341. if (!this.tableList.length) {
  342. this.tableFrom.page =
  343. this.tableFrom.page == 1 ? 1 : this.tableFrom.page - 1;
  344. }
  345. this.getList();
  346. })
  347. .catch((res) => {
  348. this.$Message.error(res.msg);
  349. });
  350. },
  351. // 列表
  352. getList() {
  353. this.loading = true;
  354. // this.tableFrom.start_status = this.tableFrom.start_status || "";
  355. // this.tableFrom.is_show = this.tableFrom.is_show || "";
  356. getInventoryList(this.tableFrom)
  357. .then(async (res) => {
  358. let data = res.data;
  359. this.tableList = data.data;
  360. this.total = data.count;
  361. this.loading = false;
  362. })
  363. .catch((res) => {
  364. this.loading = false;
  365. this.$Message.error(res.msg);
  366. });
  367. },
  368. pageChange(index) {
  369. this.tableFrom.page = index;
  370. this.getList();
  371. },
  372. // 表格搜索
  373. tableSearchs() {
  374. this.tableFrom.page = 1;
  375. this.getList();
  376. },
  377. // 具体日期
  378. onchangeTime(e) {
  379. this.timeVal = e;
  380. this.tableFrom.integral_time = this.timeVal[0] ? this.timeVal.join("-") : "";
  381. },
  382. // 修改是否显示
  383. onchangeIsShow(row) {
  384. let data = {
  385. id: row.id,
  386. is_show: row.is_show,
  387. };
  388. integralIsShowApi(data)
  389. .then(async (res) => {
  390. this.$Message.success(res.msg);
  391. })
  392. .catch((res) => {
  393. this.$Message.error(res.msg);
  394. });
  395. },
  396. },
  397. };
  398. </script>
  399. <style scoped lang="stylus">
  400. .tabBox_img {
  401. width: 36px;
  402. height: 36px;
  403. border-radius: 4px;
  404. cursor: pointer;
  405. img {
  406. width: 100%;
  407. height: 100%;
  408. }
  409. }
  410. </style>