index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  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="创建时间:" label-for="user_time">
  10. <DatePicker
  11. :editable="false"
  12. @on-change="onchangeTime"
  13. :value="timeVal"
  14. format="yyyy/MM/dd"
  15. type="datetimerange"
  16. placement="bottom-start"
  17. placeholder="自定义时间"
  18. class="mr20 input-add"
  19. :options="options"
  20. ></DatePicker>
  21. </FormItem> -->
  22. <!-- <FormItem label="上架状态:">
  23. <Select
  24. placeholder="请选择"
  25. clearable
  26. class="input-add"
  27. v-model="tableFrom.is_show"
  28. >
  29. <Option value="1">上架</Option>
  30. <Option value="0">下架</Option>
  31. </Select>
  32. </FormItem> -->
  33. <FormItem label="仓库:" prop="pid" label-for="pid">
  34. <Select v-model="tableFrom.wid" @on-change="userSearchs" clearable class="input-add">
  35. <Option v-for="item in data1" :value="item.id" :key="item.id">
  36. {{ item.title }}
  37. </Option>
  38. </Select>
  39. </FormItem>
  40. <FormItem label="门店:">
  41. <Select v-model="tableFrom.store_id" clearable filterable @on-change="userSearchs"
  42. class="input-add">
  43. <Option v-for="item in staffData" :value="item.id" :key="item.id">{{ item.name }}
  44. </Option>
  45. </Select>
  46. </FormItem>
  47. <FormItem label="创建人:">
  48. <Select v-model="tableFrom.create_uid" clearable filterable @on-change="userSearchs"
  49. class="input-add">
  50. <Option v-for="item in authList" :value="item.id" :key="item.id">{{ item.staff_name }}
  51. </Option>
  52. </Select>
  53. </FormItem>
  54. <!-- <FormItem label="用户搜索:" label-for="store_name">
  55. <Input class="input-add mr14" placeholder="请输入用户昵称/手机号" v-model="tableFrom.key" />
  56. <Button type="primary" @click="tableSearchs()">查询</Button>
  57. </FormItem> -->
  58. <!-- <Button
  59. v-auth="['marketing-store_seckill-create']"
  60. type="primary"
  61. icon="md-add"
  62. @click="addMore"
  63. class="mr10"
  64. >批量添加积分商品</Button
  65. > -->
  66. <!--<Button v-auth="['export-storeSeckill']" class="export" icon="ios-share-outline" @click="exports">导出</Button>-->
  67. </Form>
  68. </div>
  69. </Card>
  70. <Card :bordered="false" dis-hover class="ivu-mt">
  71. <!-- 操作 -->
  72. <Button v-auth="['marketing-store_seckill-create']" type="primary" @click="add" class="mr10">添加要货</Button>
  73. <!-- 积分商品-表格 -->
  74. <Table :columns="columns1" :data="tableList" :loading="loading" highlight-row no-userFrom-text="暂无数据"
  75. no-filtered-userFrom-text="暂无筛选结果" class="ivu-mt">
  76. <template slot-scope="{ row, index }" slot="image">
  77. <viewer>
  78. <div class="tabBox_img">
  79. <img v-lazy="row.avatar" />
  80. </div>
  81. </viewer>
  82. </template>
  83. <template slot-scope="{ row, index }" slot="create_time">
  84. <span> {{ row.create_time | formatDate }}</span>
  85. </template>
  86. <template slot-scope="{ row, index }" slot="auth_time">
  87. <span v-if="row.auth_time"> {{ row.auth_time | formatDate }}</span>
  88. </template>
  89. <template slot-scope="{ row, index }" slot="auser">
  90. <div>名称:{{row.auser.staff_name}}</div>
  91. <div>管理员ID:{{row.auser.admin_id}}</div>
  92. <div>ID:{{row.auser.id}}</div>
  93. <div>手机:{{row.auser.phone}}</div>
  94. </template>
  95. <template slot-scope="{ row, index }" slot="cuser">
  96. <div>名称:{{row.cuser.staff_name}}</div>
  97. <div>管理员ID:{{row.cuser.admin_id}}</div>
  98. <div>ID:{{row.cuser.id}}</div>
  99. <div>手机:{{row.cuser.phone}}</div>
  100. </template>
  101. <template slot-scope="{ row, index }" slot="ware">
  102. <div>名称:{{row.ware.title}}</div>
  103. <div>ID:{{row.ware.id}}</div>
  104. <div>手机:{{row.ware.phone}}</div>
  105. <div>地址:{{row.ware.detailed_address}}</div>
  106. </template>
  107. <template slot-scope="{ row, index }" slot="info">
  108. <!-- {{row.info}} -->
  109. <div v-for="item in row.info" class="info">
  110. <div>
  111. 商品名称:{{item.product_name}}
  112. </div>
  113. <div>
  114. 商品ID:{{item.product_id}}
  115. </div>
  116. <div>
  117. 数量:{{item.want_product_num*1}}{{' '}}{{item.unit_name}}
  118. </div>
  119. </div>
  120. </template>
  121. <template slot-scope="{ row, index }" slot="store">
  122. <viewer style="display: flex;">
  123. <div class="tabBox_img">
  124. <img v-lazy="row.store.image" />
  125. </div>
  126. <div>门店:{{row.store.name}}<br>ID:{{row.store.id}}</div>
  127. </viewer>
  128. </template>
  129. <template slot-scope="{ row, index }" slot="is_system">
  130. <span> {{ row.is_system ? '是': '否'}}</span>
  131. </template>
  132. <template slot-scope="{ row, index }" slot="is_show">
  133. <i-switch v-model="row.is_show" :value="row.is_show" :true-value="1" :false-value="0"
  134. @on-change="onchangeIsShow(row)" size="large">
  135. <span slot="open">上架</span>
  136. <span slot="close">下架</span>
  137. </i-switch>
  138. </template>
  139. <template slot-scope="{ row, index }" slot="status">
  140. <Tag color="default" v-if="row.status == 0">待审核</Tag>
  141. <Tag color="primary" v-if="row.status == 1">通过</Tag>
  142. <Tag color="success" v-if="row.status == 3">完成</Tag>
  143. <Tag color="error" v-if="row.status == -1">拒绝</Tag>
  144. <Tag color="warning" v-if="row.status == 2">部分完成</Tag>
  145. <Tag color="magenta" v-if="row.status == -2">无效</Tag>
  146. </template>
  147. <template slot-scope="{ row, index }" slot="action">
  148. <a @click="look(row)">详情</a>
  149. <template v-if="row.status == 0">
  150. <Divider type="vertical" />
  151. <a @click="edit(row)">编辑</a>
  152. <Divider type="vertical" />
  153. <a @click="pass(row)">审核</a>
  154. <Divider type="vertical" />
  155. <a @click="del(row, '删除要货单', index)">删除</a>
  156. </template>
  157. </template>
  158. </Table>
  159. <div class="acea-row row-right page">
  160. <Page :total="total" :current="tableFrom.page" show-elevator show-total @on-change="pageChange"
  161. :page-size="tableFrom.limit" />
  162. </div>
  163. </Card>
  164. <Modal
  165. v-model="modalpass"
  166. scrollable
  167. title="请修改内容"
  168. class="order_box"
  169. :closable="false"
  170. :mask-closable="false"
  171. >
  172. <Form
  173. ref="remarks"
  174. :model="remarks"
  175. :label-width="80"
  176. @submit.native.prevent
  177. >
  178. <FormItem label="审核人:">
  179. <!-- <Input
  180. v-model="remarks.mark"
  181. maxlength="200"
  182. show-word-limit
  183. type="textarea"
  184. placeholder="请填写备注~"
  185. style="width: 100%"
  186. /> -->
  187. <Select v-model="remarks.auth_uid" clearable filterable @on-change="userSearchse"
  188. class="input-add">
  189. <Option v-for="item in authLists" :value="item.id" :key="item.id">{{ item.staff_name }}
  190. </Option>
  191. </Select>
  192. </FormItem>
  193. <FormItem label="状态:">
  194. <Select v-model="remarks.status" clearable filterable
  195. class="input-add">
  196. <Option :value="1" >通过</Option>
  197. <Option :value="-1" >拒绝</Option>
  198. <Option :value="2" >部分完成</Option>
  199. <Option :value="3" >完成</Option>
  200. <Option :value="-2" >无效</Option>
  201. </Select>
  202. </FormItem>
  203. </Form>
  204. <div slot="footer">
  205. <Button type="primary" @click="putRemark()">提交</Button>
  206. <Button @click="cancel()">取消</Button>
  207. </div>
  208. </Modal>
  209. </div>
  210. </template>
  211. <script>
  212. import {
  213. mapState
  214. } from "vuex";
  215. import {
  216. integralProductListApi,
  217. integralIsShowApi,
  218. storeSeckillApi,
  219. } from "@/api/marketing";
  220. import {
  221. getWantList,
  222. getUserInfo,
  223. getGodownList,
  224. getUserList,
  225. seveWant
  226. } from "@/api/erp";
  227. import {
  228. staffListInfo
  229. } from "@/api/store";
  230. import {
  231. formatDate
  232. } from "@/utils/validate";
  233. import timeOptions from "@/utils/timeOptions";
  234. import Setting from "@/setting";
  235. export default {
  236. name: "want",
  237. filters: {
  238. formatDate(time) {
  239. if (time !== 0) {
  240. let date = new Date(time * 1000);
  241. return formatDate(date, "yyyy-MM-dd");
  242. }
  243. },
  244. showStatus(status) {
  245. let str = ''
  246. switch (status) {
  247. case 0:
  248. str = '待审核';
  249. break;
  250. case -2:
  251. str = '无效';
  252. break;
  253. case -1:
  254. str = '拒绝';
  255. break;
  256. case 1:
  257. str = '通过';
  258. break;
  259. case 2:
  260. str = '部分完成';
  261. break;
  262. case 3:
  263. str = '完成';
  264. break;
  265. default:
  266. str = '';
  267. break;
  268. }
  269. return str
  270. }
  271. },
  272. data() {
  273. return {
  274. remarks: {
  275. id: 0,
  276. status: '',
  277. auth_uid: "",
  278. auth_admin_id: "",
  279. },
  280. modalpass:false,
  281. roterPre: Setting.roterPre,
  282. loading: false,
  283. options: timeOptions,
  284. columns1: [{
  285. title: "ID",
  286. key: "id",
  287. width: 80,
  288. },
  289. {
  290. title: "要货单号",
  291. key: "want_order_id",
  292. minWidth: 150,
  293. },
  294. {
  295. title: '商品信息',
  296. slot: 'info',
  297. minWidth: 300,
  298. },
  299. {
  300. title: "门店信息",
  301. slot: "store",
  302. minWidth: 200,
  303. },
  304. {
  305. title: "创建人",
  306. slot: "cuser",
  307. minWidth: 200,
  308. },
  309. {
  310. title: "仓库信息",
  311. slot: "ware",
  312. minWidth: 200,
  313. },
  314. {
  315. title: "审核人信息",
  316. slot: "auser",
  317. minWidth: 200,
  318. },
  319. {
  320. title: '审核时间',
  321. slot: 'auth_time',
  322. minWidth: 80,
  323. },
  324. {
  325. title: "状态",
  326. slot: "status",
  327. minWidth: 100,
  328. },
  329. {
  330. title: "创建时间",
  331. slot: "create_time",
  332. minWidth: 90,
  333. },
  334. {
  335. title: "操作",
  336. slot: "action",
  337. fixed: "right",
  338. width: 200,
  339. },
  340. ],
  341. tableList: [],
  342. timeVal: [],
  343. grid: {
  344. xl: 7,
  345. lg: 10,
  346. md: 12,
  347. sm: 24,
  348. xs: 24,
  349. },
  350. tableFrom: {
  351. // integral_time: "",
  352. // is_show: "",
  353. // store_name: "",
  354. // key: '',
  355. create_uid:"",
  356. store_id:"",
  357. wid:"",
  358. page: 1,
  359. limit: 15,
  360. },
  361. total: 0,
  362. staffData:[],
  363. data1:[],
  364. authList:[],
  365. authLists: []
  366. };
  367. },
  368. computed: {
  369. ...mapState("admin/layout", ["isMobile"]),
  370. labelWidth() {
  371. return this.isMobile ? undefined : 96;
  372. },
  373. labelPosition() {
  374. return this.isMobile ? "top" : "right";
  375. },
  376. },
  377. created() {
  378. this.getList();
  379. },
  380. mounted() {
  381. this.getGodownList()
  382. this.staffList()
  383. this.getUserList()
  384. },
  385. methods: {
  386. putRemark() {
  387. seveWant(this.remarks.id,this.remarks).then(res => {
  388. this.cancel()
  389. this.getList();
  390. })
  391. },
  392. cancel() {
  393. this.remarks = {
  394. id:0,
  395. status: '',
  396. auth_uid: "",
  397. auth_admin_id: "",}
  398. this.modalpass = false
  399. },
  400. getUserList() {
  401. getUserList().then(res => {
  402. // console.log(res);
  403. this.authList = res.data.data
  404. })
  405. },
  406. userSearchs(e) {
  407. this.tableFrom.page = 1;
  408. this.getList();
  409. },
  410. userSearchse(e) {
  411. let auth = this.authLists.find(item => item.id == e)
  412. console.log(auth,'auth');
  413. this.remarks.auth_admin_id = auth.admin_id
  414. },
  415. getGodownList() {
  416. getGodownList().then(res => {
  417. console.log(res);
  418. this.data1 = res.data.data
  419. })
  420. },
  421. staffList() {
  422. staffListInfo()
  423. .then((res) => {
  424. this.staffData = res.data;
  425. })
  426. .catch((err) => {
  427. this.$Message.error(err.msg);
  428. });
  429. },
  430. // 添加
  431. add() {
  432. this.$router.push({
  433. path: this.roterPre + "/erp/want_add?id=0"
  434. });
  435. },
  436. addMore() {
  437. this.$router.push({
  438. path: this.roterPre + "/marketing/store_integral/add_store_integral",
  439. });
  440. },
  441. orderList(row) {
  442. this.$router.push({
  443. path: this.roterPre + "/marketing/store_integral/order_list",
  444. query: {
  445. product_id: row.id,
  446. },
  447. });
  448. },
  449. // 导出
  450. exports() {
  451. let formValidate = this.tableFrom;
  452. let data = {
  453. start_status: formValidate.start_status,
  454. status: formValidate.status,
  455. store_name: formValidate.store_name,
  456. };
  457. storeSeckillApi(data)
  458. .then((res) => {
  459. location.href = res.data[0];
  460. })
  461. .catch((res) => {
  462. this.$Message.error(res.msg);
  463. });
  464. },
  465. // 编辑
  466. edit(row) {
  467. this.$router.push({
  468. path: this.roterPre + "/erp/want_add?id=" + row.id
  469. });
  470. },
  471. // 一键复制
  472. copy(row) {
  473. this.$router.push({
  474. path: this.roterPre + "/marketing/store_integral/create/" + row.id + "/1",
  475. });
  476. },
  477. // 删除
  478. del(row, tit, num) {
  479. let delfromData = {
  480. title: tit,
  481. num: num,
  482. url: `erp/want/del/${row.id}`,
  483. method: "DELETE",
  484. ids: "",
  485. };
  486. this.$modalSure(delfromData)
  487. .then((res) => {
  488. this.$Message.success(res.msg);
  489. this.tableList.splice(num, 1);
  490. if (!this.tableList.length) {
  491. this.tableFrom.page =
  492. this.tableFrom.page == 1 ? 1 : this.tableFrom.page - 1;
  493. }
  494. this.getList();
  495. })
  496. .catch((res) => {
  497. this.$Message.error(res.msg);
  498. });
  499. },
  500. pass(row) {
  501. let qdata = {}
  502. if(row.wid) {
  503. qdata.wid = row.wid
  504. }else {
  505. qdata.store_id = row.store_id
  506. }
  507. this.authLists = []
  508. this.remarks.id = row.id
  509. getUserList(qdata).then(res => {
  510. this.authLists = res.data.data
  511. this.modalpass = true;
  512. })
  513. },
  514. // 列表
  515. getList() {
  516. this.loading = true;
  517. // this.tableFrom.start_status = this.tableFrom.start_status || "";
  518. // this.tableFrom.is_show = this.tableFrom.is_show || "";
  519. getWantList(this.tableFrom)
  520. .then(async (res) => {
  521. let data = res.data;
  522. this.tableList = data.data;
  523. this.total = data.count;
  524. this.loading = false;
  525. })
  526. .catch((res) => {
  527. this.loading = false;
  528. this.$Message.error(res.msg);
  529. });
  530. },
  531. pageChange(index) {
  532. this.tableFrom.page = index;
  533. this.getList();
  534. },
  535. // 表格搜索
  536. tableSearchs() {
  537. this.tableFrom.page = 1;
  538. this.getList();
  539. },
  540. // 具体日期
  541. onchangeTime(e) {
  542. this.timeVal = e;
  543. this.tableFrom.integral_time = this.timeVal[0] ? this.timeVal.join("-") : "";
  544. },
  545. // 修改是否显示
  546. onchangeIsShow(row) {
  547. let data = {
  548. id: row.id,
  549. is_show: row.is_show,
  550. };
  551. integralIsShowApi(data)
  552. .then(async (res) => {
  553. this.$Message.success(res.msg);
  554. })
  555. .catch((res) => {
  556. this.$Message.error(res.msg);
  557. });
  558. },
  559. },
  560. };
  561. </script>
  562. <style scoped lang="stylus">
  563. .tabBox_img {
  564. width: 36px;
  565. height: 36px;
  566. border-radius: 4px;
  567. cursor: pointer;
  568. img {
  569. width: 100%;
  570. height: 100%;
  571. }
  572. }
  573. .info {
  574. padding-top: 10px;
  575. border-bottom: 1px dashed #515a6e;
  576. &:last-of-type {
  577. border: none;
  578. }
  579. }
  580. </style>