index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <template>
  2. <!-- 订单-售后订单 -->
  3. <div>
  4. <!-- <Card :bordered="false" dis-hover class="ivu-mt" :padding="0">
  5. <div class="new_card_pd">
  6. <Form ref="pagination" inline :model="pagination" :label-width="labelWidth"
  7. :label-position="labelPosition" @submit.native.prevent>
  8. <FormItem label="支付状态:">
  9. <Select v-model="pagination.paid" class="input-add">
  10. <Option v-for="(item, index) in num" :value="item.value" :key="index">{{ item.name }}
  11. </Option>
  12. </Select>
  13. </FormItem>
  14. <FormItem label="员工ID:" label-for="title">
  15. <div class='flex-search'>
  16. <Input v-model="pagination.work_member_id" icon="ios-search" @on-click='openmid'
  17. placeholder="请输入员工ID" class="input-add mr14" />
  18. </div>
  19. </FormItem>
  20. <FormItem label="用户ID:" label-for="title">
  21. <div class='flex-search'>
  22. <Input v-model="pagination.uid" icon="ios-search" @on-click='openuid' placeholder="请输入用户ID"
  23. class="input-add mr14" />
  24. </div>
  25. </FormItem>
  26. <FormItem label="订单搜索:" label-for="title">
  27. <Input v-model="pagination.order_id" placeholder="请输入订单号" class="input-add mr14" />
  28. <Button type="primary" @click="orderSearch()">查询</Button>
  29. </FormItem>
  30. </Form>
  31. </div>
  32. </Card> -->
  33. <Card :bordered="false" dis-hover class="ivu-mt">
  34. <!-- 售后订单表格 -->
  35. <Table :columns="thead" :data="tbody" ref="table" :loading="loading" highlight-row no-userFrom-text="暂无数据"
  36. no-filtered-userFrom-text="暂无筛选结果">
  37. <template slot-scope="{ row }" slot="order_id">
  38. <span v-text="row.order_id" style="display: block"></span>
  39. <span v-show="row.is_del === 1 && row.delete_time == null" class="span-del">用户已删除</span>
  40. </template>
  41. <template slot-scope="{ row }" slot="nickname">
  42. <div>姓名:{{ row.real_name }}</div>
  43. <div>充值号码:{{ row.rechargeno }}</div>
  44. </template>
  45. <template slot-scope="{ row, index }" slot="kf">
  46. <span class="tabBox_pice">{{showName(row.work_member_id)}}</span>
  47. </template>
  48. <template slot-scope="{ row }" slot="goods_name">
  49. <div class="tabBox_serve" >
  50. {{row.goods_name}} ( {{row.pay_price}} )
  51. </div>
  52. </template>
  53. <template slot-scope="{ row, index }" slot="pay_price">
  54. <span class="tabBox_pice">{{row.pay_price}}</span>
  55. </template>
  56. <template slot-scope="{ row, index }" slot="reservation_time">
  57. <span class="tabBox_pice">{{showTime(row.reservation_time)}}</span>
  58. </template>
  59. <template slot-scope="{ row, index }" slot="status">
  60. <div class="tabBox_serve" v-if="row.status==0">
  61. 待下单
  62. </div>
  63. <div class="tabBox_serve" v-if="row.status==1">
  64. 未充值
  65. </div>
  66. <div class="tabBox_serve" v-if="row.status==2">
  67. 已充值
  68. </div>
  69. <div class="tabBox_serve" v-if="row.status== -1">
  70. 已取消
  71. </div>
  72. </template>
  73. <template slot-scope="{ row }" slot="pay_type">
  74. <div class="tabBox_serve" v-if="row.pay_type=='weixin'">
  75. 微信
  76. </div>
  77. <div class="tabBox_serve" v-if="row.pay_type=='yue'">
  78. 余额
  79. </div>
  80. <div class="tabBox_serve" v-if="row.pay_type=='offline'">
  81. 线下
  82. </div>
  83. <div class="tabBox_serve" v-if="row.pay_type=='alipay'">
  84. 支付宝
  85. </div>
  86. <div class="tabBox_serve" v-if="row.pay_type=='cash'">
  87. 现金
  88. </div>
  89. </template>
  90. <template slot-scope="{ row }" slot="paid">
  91. <div class="tabBox_serve" v-if="row.paid==0" style="color: red;">
  92. 未支付
  93. </div>
  94. <div class="tabBox_serve" v-if="row.paid==1" style="color: #57a3f3;">
  95. 已支付
  96. </div>
  97. </template>
  98. <template slot-scope="{ row, index }" slot="add_time">
  99. <span class="tabBox_pice">{{showTime(row.add_time)}}</span>
  100. </template>
  101. <template slot-scope="{ row }" slot="action">
  102. <a @click="changeMenu(row)">修改状态</a>
  103. </template>
  104. </Table>
  105. <div class="acea-row row-right page">
  106. <Page :total="total" :current="pagination.page" show-elevator show-total @on-change="pageChange"
  107. :page-size="pagination.limit" />
  108. </div>
  109. </Card>
  110. <Modal v-model="modals" scrollable title="修改订单状态" class="order_box" :closable="false">
  111. <Form :label-width="80">
  112. <FormItem label="订单状态:" prop="chooseId">
  113. <Select v-model="chooseId" style="width: 250px">
  114. <Option v-for="item in ygList" :key="item.id" :value="item.id">{{ item.name }}</Option>
  115. </Select>
  116. </FormItem>
  117. </Form>
  118. <div slot="footer">
  119. <Button type="primary" @click="goCancal">提交</Button>
  120. <Button @click="cancal">取消</Button>
  121. </div>
  122. </Modal>
  123. <Modal v-model="userListShow" width='80' mask title="用户选择">
  124. <userlist @imageObject='checkUser'></userlist>
  125. <template #footer>
  126. <Button @click="userListShow=false">取消</Button>
  127. </template>
  128. </Modal>
  129. <Modal v-model="memberListShow" width='80' mask title="员工选择">
  130. <staffList @getProductId='checkmember'></staffList>
  131. <template #footer>
  132. <Button @click="memberListShow=false">取消</Button>
  133. </template>
  134. </Modal>
  135. <Modal v-model="delModel" scrollable title="退单" class="order_box" :closable="false">
  136. <Form :label-width="80">
  137. <FormItem label="备注:">
  138. <Input v-model="delData.remarks" placeholder="请输入退单备注" />
  139. </FormItem>
  140. </Form>
  141. <div slot="footer">
  142. <Button type="primary" @click="delConfirm">提交</Button>
  143. <Button @click="delModel=false">取消</Button>
  144. </div>
  145. </Modal>
  146. </div>
  147. </template>
  148. <script>
  149. import {
  150. mapState
  151. } from "vuex";
  152. import {
  153. getServeOrder,
  154. member_update,
  155. active_refund_order,
  156. getRechargeList,
  157. getRechargeOrderList,
  158. completeOrderLst,
  159. deleteOrderLst
  160. } from "@/api/order";
  161. import {
  162. getYgList
  163. } from "@/api/store"
  164. import {
  165. erpConfig
  166. } from "@/api/erp";
  167. import userlist from "@/components/customerInfo/index";
  168. import staffList from "@/components/staffList/index";
  169. export default {
  170. components: {
  171. userlist,
  172. staffList
  173. },
  174. data() {
  175. return {
  176. delModel: false,
  177. delData: {
  178. id: '',
  179. remarks: ''
  180. },
  181. memberListShow: false,
  182. // 显示用户列表
  183. userListShow: false,
  184. modals: false,
  185. order_id: '',
  186. ygList: [],
  187. chooseId: 0,
  188. openErp: false,
  189. thead: [
  190. {
  191. title: "id",
  192. align: "center",
  193. key: "id",
  194. minWidth: 160,
  195. },
  196. {
  197. title: "用户信息",
  198. slot: "nickname",
  199. minWidth: 140,
  200. },
  201. {
  202. title: "商品信息",
  203. slot: "goods_name",
  204. minWidth: 250,
  205. },
  206. {
  207. title: "支付金额",
  208. slot: "pay_price",
  209. minWidth: 70,
  210. },
  211. {
  212. title: "支付方式",
  213. slot: "pay_type",
  214. minWidth: 80,
  215. },
  216. {
  217. title: "支付状态",
  218. slot: "paid",
  219. minWidth: 70,
  220. },
  221. {
  222. title: "状态",
  223. slot: "status",
  224. minWidth: 80,
  225. },
  226. {
  227. title: "下单时间",
  228. key: "create_time",
  229. minWidth: 130,
  230. },
  231. {
  232. title: "操作",
  233. slot: "action",
  234. fixed: "right",
  235. minWidth: 150,
  236. align: "center",
  237. },
  238. ],
  239. tbody: [],
  240. num: [{
  241. name: '待支付',
  242. value: 0
  243. },
  244. {
  245. name: '已支付',
  246. value: 1
  247. }
  248. ],
  249. loading: false,
  250. total: 0,
  251. pagination: {
  252. page: 1,
  253. limit: 15,
  254. order_id: "",
  255. time: "",
  256. status: 0,
  257. uid: '',
  258. work_member_id: ''
  259. },
  260. };
  261. },
  262. computed: {
  263. labelWidth() {
  264. return this.isMobile ? undefined : 96;
  265. },
  266. labelPosition() {
  267. return this.isMobile ? "top" : "right";
  268. },
  269. },
  270. created() {
  271. this.getYgList()
  272. this.getOrderList();
  273. this.getRechargeList()
  274. this.getRechargeOrderList()
  275. },
  276. methods: {
  277. getRechargeList() {
  278. getRechargeList().then(res => {
  279. console.log(res)
  280. })
  281. },
  282. getRechargeOrderList() {
  283. getRechargeOrderList().then(res => {
  284. console.log(res)
  285. })
  286. },
  287. delConfirm(row) {
  288. const that = this;
  289. that.delModel = false;
  290. that.$Modal.confirm({
  291. title: "确认删除",
  292. content: '<p>确定删除吗?</p><p>删除后将无法恢复,请谨慎操作!</p>',
  293. onOk: () => {
  294. console.log('进入');
  295. setTimeout(function() {
  296. that.$Modal.remove();
  297. deleteOrderLst({
  298. goods_id: row.id
  299. }).then((res) => {
  300. that.getOrderList()
  301. that.$Message.success("删除成功");
  302. }).catch((err) => {
  303. that.$Message.error(err.msg);
  304. })
  305. }, 300);
  306. }
  307. });
  308. },
  309. del(row) {
  310. const that = this;
  311. that.delModel = true;
  312. that.delData.id = row.id;
  313. },
  314. // 打开弹窗
  315. openmid(e) {
  316. this.memberListShow = true;
  317. },
  318. // 选中员工
  319. checkmember(res) {
  320. let data = res[0];
  321. this.memberListShow = false;
  322. this.pagination.work_member_id = data.id;
  323. },
  324. // 选中用户
  325. checkUser(res) {
  326. this.userListShow = false;
  327. this.pagination.uid = res.uid;
  328. },
  329. // 打开弹窗
  330. openuid(e) {
  331. this.userListShow = true;
  332. },
  333. showName(id) {
  334. let yg = this.ygList.find(item => {
  335. return item.id == id
  336. })
  337. // console.log(yg,'ygygygyg')
  338. return yg ? yg.name : ''
  339. },
  340. getYgList() {
  341. // getYgList({
  342. // page: 1,
  343. // limit: 1000
  344. // }).then(res => {
  345. // this.ygList = res.data.list
  346. // })
  347. this.ygList = [
  348. {
  349. name: '待下单',
  350. id: 0
  351. },
  352. {
  353. name: '未充值',
  354. id: 1
  355. },
  356. {
  357. name: '已充值',
  358. id: 2
  359. },
  360. {
  361. name: '已取消',
  362. id: -1
  363. }
  364. ]
  365. },
  366. showTime(time) {
  367. var date = new Date(time * 1000);
  368. var year = date.getFullYear(); // 获取年份
  369. var month = ("0" + (date.getMonth() + 1)).slice(-2); // 获取月份(注意月份从 0 开始,需要加 1)
  370. var day = ("0" + date.getDate()).slice(-2); // 获取日期
  371. var hours = ("0" + date.getHours()).slice(-2); // 获取小时
  372. var minutes = ("0" + date.getMinutes()).slice(-2); // 获取分钟
  373. var seconds = ("0" + date.getSeconds()).slice(-2); // 获取秒钟
  374. var dateString = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; // 自定义时间格式
  375. return dateString
  376. },
  377. showPrice(list) {
  378. let price = 0;
  379. list.forEach(item => {
  380. price += item.pay_price * 1
  381. })
  382. return price.toFixed(2)
  383. },
  384. // 操作
  385. changeMenu(row, name) {
  386. this.modals = true
  387. this.order_id = row.id
  388. },
  389. cancal() {
  390. this.modals = false
  391. },
  392. getygList() {
  393. getYgList().then(res => {
  394. console.log(res)
  395. this.ygList = res.data.list
  396. })
  397. },
  398. goCancal() {
  399. if (this.chooseId == '') {
  400. return this.$Message.error('请选择订单状态')
  401. }
  402. this.modals = false
  403. completeOrderLst({
  404. id: this.order_id,
  405. status: this.chooseId
  406. }).then(res => {
  407. this.$Message.success(res.msg)
  408. this.getOrderList()
  409. }).catch(err => {
  410. this.$Message.error(err.msg)
  411. })
  412. },
  413. // 订单列表
  414. getOrderList() {
  415. this.loading = true;
  416. getRechargeOrderList(this.pagination)
  417. .then((res) => {
  418. this.loading = false;
  419. const {
  420. count,
  421. list,
  422. num
  423. } = res.data;
  424. this.total = count;
  425. this.tbody = list;
  426. })
  427. .catch((err) => {
  428. this.loading = false;
  429. this.$Message.error(err.msg);
  430. });
  431. },
  432. // 分页
  433. pageChange(index) {
  434. this.pagination.page = index;
  435. this.getOrderList();
  436. },
  437. // 订单搜索
  438. orderSearch() {
  439. this.pagination.page = 1;
  440. this.getOrderList();
  441. },
  442. },
  443. };
  444. </script>
  445. <style lang="stylus" scoped>
  446. .span-del {
  447. color: #ed4014;
  448. display: block
  449. }
  450. .code {
  451. position: relative;
  452. }
  453. .QRpic {
  454. width: 180px;
  455. height: 259px;
  456. img {
  457. width: 100%;
  458. height: 100%;
  459. }
  460. }
  461. .tabBox {
  462. width: 100%;
  463. height: 100%;
  464. display: flex;
  465. align-items: center;
  466. justify-content: space-between;
  467. .tabRow {
  468. width: 0;
  469. flex-grow: 1;
  470. display: flex;
  471. }
  472. .tabBox_serve {
  473. flex-shrink: 0;
  474. padding-left: 5px;
  475. }
  476. .tabBox_content {
  477. width: 0;
  478. flex-grow: 1;
  479. padding-left: 5px;
  480. }
  481. .tabBox_pice {
  482. flex-shrink: 0;
  483. }
  484. .tabBox_img {
  485. width: 30px;
  486. height: 30px;
  487. flex-shrink: 0;
  488. img {
  489. width: 100%;
  490. height: 100%;
  491. }
  492. }
  493. .tabBox_tit {
  494. flex-grow: 1;
  495. font-size: 12px !important;
  496. letter-spacing: 1px;
  497. box-sizing: border-box;
  498. }
  499. }
  500. .tabBox+.tabBox {
  501. margin-top: 5px;
  502. }
  503. .pictrue-box {
  504. display: flex;
  505. align-item: center;
  506. }
  507. .pictrue {
  508. width: 25px;
  509. height: 25px;
  510. }
  511. .flex-search {
  512. display: flex;
  513. }
  514. </style>