index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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="pagination" inline :model="pagination" :label-width="labelWidth"
  8. :label-position="labelPosition" @submit.native.prevent>
  9. <FormItem label="订单状态:">
  10. <Select v-model="pagination.status" class="input-add">
  11. <Option v-for="(item, index) in num" :value="item.value" :key="index">{{ item.name }}
  12. </Option>
  13. </Select>
  14. </FormItem>
  15. <FormItem label="用户ID:" label-for="title">
  16. <div class='flex-search'>
  17. <Input v-model="pagination.uid" icon="ios-search" @on-click='openuid' placeholder="请输入用户ID"
  18. class="input-add mr14" />
  19. </div>
  20. </FormItem>
  21. <FormItem label="员工ID:" label-for="title">
  22. <div class='flex-search'>
  23. <Input v-model="pagination.work_member_id" icon="ios-search" @on-click='openmid'
  24. placeholder="请输入员工ID" class="input-add mr14" />
  25. </div>
  26. </FormItem>
  27. <FormItem label="订单搜索:" label-for="title">
  28. <Input v-model="pagination.order_id" placeholder="请输入订单号" class="input-add mr14" />
  29. <Button type="primary" @click="orderSearch()">查询</Button>
  30. </FormItem>
  31. </Form>
  32. </div>
  33. </Card>
  34. <Card :bordered="false" dis-hover class="ivu-mt">
  35. <!-- 售后订单表格 -->
  36. <Table :columns="thead" :data="tbody" ref="table" :loading="loading" highlight-row no-userFrom-text="暂无数据"
  37. no-filtered-userFrom-text="暂无筛选结果">
  38. <template slot-scope="{ row }" slot="order_id">
  39. <span v-text="row.order_id" style="display: block"></span>
  40. <span v-show="row.is_del === 1 && row.delete_time == null" class="span-del">用户已删除</span>
  41. </template>
  42. <template slot-scope="{ row }" slot="nickname">
  43. <div>用户名:{{ row.real_name }}</div>
  44. <div>手机号:{{ row.user_phone }}</div>
  45. </template>
  46. <template slot-scope="{ row, index }" slot="kf">
  47. <span class="tabBox_pice">{{showName(row.work_member_id)}}</span>
  48. </template>
  49. <template slot-scope="{ row }" slot="info">
  50. <div class="tabBox" v-for="(val, i) in row.info" :key="i">
  51. <div class="tabBox_img" v-viewer>
  52. <img v-lazy="val.slider_image" />
  53. </div>
  54. <div class="tabBox_content">
  55. <div class="tabBox_tit">{{ val.store_name }}</div>
  56. <div class="tabBox_pice">{{'¥' + val.pay_price}}</div>
  57. </div>
  58. </div>
  59. </template>
  60. <template slot-scope="{ row, index }" slot="pay_price">
  61. <span class="tabBox_pice">{{'¥' + showPrice(row.info)}}</span>
  62. </template>
  63. <template slot-scope="{ row, index }" slot="reservation_time">
  64. <span class="tabBox_pice">{{showTime(row.reservation_time)}}</span>
  65. </template>
  66. <template slot-scope="{ row, index }" slot="store">
  67. <span class="tabBox_pice">{{row.store.name}}</span>
  68. </template>
  69. <!-- <template slot-scope="{ row }" slot="status">
  70. <Tag color="blue" size="medium" v-if="row.status == -1">退款</Tag>
  71. <Tag color="blue" size="medium" v-if="row.status == 0">待服务</Tag>
  72. <Tag color="blue" size="medium" v-if="row.status == 2">已完成</Tag>
  73. </template> -->
  74. <template slot-scope="{ row }" slot="statusName">
  75. <Tooltip theme="dark" max-width="300" :delay="600">
  76. <div v-html="row.refund_reason" class="pt5"></div>
  77. <div slot="content">
  78. <div class="pt5">退款原因:{{row.refund_explain}}</div>
  79. <div v-if="row.refund_goods_explain" class="pt5">退货原因:{{row.refund_goods_explain}}</div>
  80. </div>
  81. </Tooltip>
  82. <div class="pictrue-box" v-if="row.refund_img">
  83. <div v-viewer v-for="(item, index) in row.refund_img || []" :key="index">
  84. <img class="pictrue mr10" v-lazy="item" :src="item" />
  85. </div>
  86. </div>
  87. </template>
  88. <template slot-scope="{ row, index }" slot="add_time">
  89. <span class="tabBox_pice">{{showTime(row.add_time)}}</span>
  90. </template>
  91. <template slot-scope="{ row }" slot="action">
  92. <a @click="changeMenu(row)" v-if="row.status == 0">修改员工</a>
  93. </template>
  94. </Table>
  95. <div class="acea-row row-right page">
  96. <Page :total="total" :current="pagination.page" show-elevator show-total @on-change="pageChange"
  97. :page-size="pagination.limit" />
  98. </div>
  99. </Card>
  100. <Modal v-model="modals" scrollable title="选择员工" class="order_box" :closable="false">
  101. <Form :label-width="80">
  102. <FormItem label="员工:" prop="chooseId">
  103. <Select v-model="chooseId" style="width: 250px">
  104. <Option v-for="item in ygList" :key="item.id" :value="item.id">{{ item.name }}</Option>
  105. </Select>
  106. </FormItem>
  107. </Form>
  108. <div slot="footer">
  109. <Button type="primary" @click="goCancal">提交</Button>
  110. <Button @click="cancal">取消</Button>
  111. </div>
  112. </Modal>
  113. <Modal v-model="userListShow" width='80' mask title="用户选择">
  114. <userlist @imageObject='checkUser'></userlist>
  115. <template #footer>
  116. <Button @click="userListShow=false">取消</Button>
  117. </template>
  118. </Modal>
  119. <Modal v-model="memberListShow" width='80' mask title="员工选择">
  120. <staffList @getProductId='checkmember'></staffList>
  121. <template #footer>
  122. <Button @click="memberListShow=false">取消</Button>
  123. </template>
  124. </Modal>
  125. </div>
  126. </template>
  127. <script>
  128. import {
  129. mapState
  130. } from "vuex";
  131. import {
  132. getServeOrder,
  133. member_update
  134. } from "@/api/order";
  135. import {
  136. getYgList
  137. } from "@/api/store"
  138. import {
  139. erpConfig
  140. } from "@/api/erp";
  141. import userlist from "@/components/customerInfo/index";
  142. import staffList from "@/components/staffList/index";
  143. export default {
  144. components: {
  145. userlist,
  146. staffList
  147. },
  148. data() {
  149. return {
  150. memberListShow: false,
  151. // 显示用户列表
  152. userListShow: false,
  153. modals: false,
  154. order_id: '',
  155. ygList: [],
  156. chooseId: 0,
  157. openErp: false,
  158. thead: [{
  159. title: "订单号",
  160. align: "center",
  161. slot: "order_id",
  162. minWidth: 160,
  163. },
  164. {
  165. title: "用户信息",
  166. slot: "nickname",
  167. minWidth: 140,
  168. },
  169. {
  170. title: "预约员工",
  171. slot: "kf",
  172. minWidth: 80,
  173. },
  174. {
  175. title: "商品信息",
  176. slot: "info",
  177. minWidth: 250,
  178. },
  179. {
  180. title: "实际支付",
  181. slot: "pay_price",
  182. minWidth: 70,
  183. },
  184. {
  185. title: "预约时间",
  186. slot: "reservation_time",
  187. minWidth: 130,
  188. },
  189. // {
  190. // title: "订单状态",
  191. // slot: "status",
  192. // minWidth: 80,
  193. // },
  194. // {
  195. // title: "退款状态",
  196. // slot: "refund_status",
  197. // minWidth: 80,
  198. // },
  199. {
  200. title: "预约门店",
  201. slot: "store",
  202. minWidth: 110,
  203. },
  204. {
  205. title: "下单时间",
  206. slot: "add_time",
  207. minWidth: 130,
  208. },
  209. {
  210. title: "操作",
  211. slot: "action",
  212. fixed: "right",
  213. minWidth: 150,
  214. align: "center",
  215. },
  216. ],
  217. tbody: [],
  218. num: [{
  219. name: '待服务',
  220. value: 0
  221. },
  222. {
  223. name: '已完成',
  224. value: 2
  225. }, {
  226. name: '退款',
  227. value: -1
  228. },
  229. ],
  230. loading: false,
  231. total: 0,
  232. pagination: {
  233. page: 1,
  234. limit: 15,
  235. order_id: "",
  236. time: "",
  237. status: 0,
  238. uid: '',
  239. work_member_id: ''
  240. },
  241. };
  242. },
  243. computed: {
  244. labelWidth() {
  245. return this.isMobile ? undefined : 96;
  246. },
  247. labelPosition() {
  248. return this.isMobile ? "top" : "right";
  249. },
  250. },
  251. created() {
  252. this.getYgList()
  253. this.getOrderList();
  254. },
  255. methods: {
  256. // 打开弹窗
  257. openmid(e) {
  258. this.memberListShow = true;
  259. },
  260. // 选中员工
  261. checkmember(res) {
  262. let data = res[0];
  263. this.memberListShow = false;
  264. this.pagination.work_member_id = data.id;
  265. },
  266. // 选中用户
  267. checkUser(res) {
  268. this.userListShow = false;
  269. this.pagination.uid = res.uid;
  270. },
  271. // 打开弹窗
  272. openuid(e) {
  273. this.userListShow = true;
  274. },
  275. showName(id) {
  276. let yg = this.ygList.find(item => {
  277. return item.id == id
  278. })
  279. // console.log(yg,'ygygygyg')
  280. return yg ? yg.name : ''
  281. },
  282. getYgList() {
  283. getYgList({
  284. page: 1,
  285. limit: 1000
  286. }).then(res => {
  287. this.ygList = res.data.list
  288. })
  289. },
  290. showTime(time) {
  291. var date = new Date(time * 1000);
  292. var year = date.getFullYear(); // 获取年份
  293. var month = ("0" + (date.getMonth() + 1)).slice(-2); // 获取月份(注意月份从 0 开始,需要加 1)
  294. var day = ("0" + date.getDate()).slice(-2); // 获取日期
  295. var hours = ("0" + date.getHours()).slice(-2); // 获取小时
  296. var minutes = ("0" + date.getMinutes()).slice(-2); // 获取分钟
  297. var seconds = ("0" + date.getSeconds()).slice(-2); // 获取秒钟
  298. var dateString = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; // 自定义时间格式
  299. return dateString
  300. },
  301. showPrice(list) {
  302. let price = 0;
  303. list.forEach(item => {
  304. price += item.pay_price * 1
  305. })
  306. return price.toFixed(2)
  307. },
  308. // 操作
  309. changeMenu(row, name) {
  310. this.modals = true
  311. this.order_id = row.id
  312. },
  313. cancal() {
  314. this.modals = false
  315. },
  316. getygList() {
  317. getYgList().then(res => {
  318. console.log(res)
  319. this.ygList = res.data.list
  320. })
  321. },
  322. goCancal() {
  323. if (this.chooseId == '') {
  324. return this.$Message.error('请选择员工')
  325. }
  326. this.modals = false
  327. member_update({
  328. id: this.order_id,
  329. work_member_id: this.chooseId
  330. }).then(res => {
  331. this.$Message.success(res.msg)
  332. this.getOrderList()
  333. }).catch(err => {
  334. this.$Message.error(err.msg)
  335. })
  336. },
  337. // 订单列表
  338. getOrderList() {
  339. this.loading = true;
  340. getServeOrder(this.pagination)
  341. .then((res) => {
  342. this.loading = false;
  343. const {
  344. count,
  345. list,
  346. num
  347. } = res.data;
  348. this.total = count;
  349. this.tbody = list;
  350. })
  351. .catch((err) => {
  352. this.loading = false;
  353. this.$Message.error(err.msg);
  354. });
  355. },
  356. // 分页
  357. pageChange(index) {
  358. this.pagination.page = index;
  359. this.getOrderList();
  360. },
  361. // 订单搜索
  362. orderSearch() {
  363. this.pagination.page = 1;
  364. this.getOrderList();
  365. },
  366. },
  367. };
  368. </script>
  369. <style lang="stylus" scoped>
  370. .span-del {
  371. color: #ed4014;
  372. display: block
  373. }
  374. .code {
  375. position: relative;
  376. }
  377. .QRpic {
  378. width: 180px;
  379. height: 259px;
  380. img {
  381. width: 100%;
  382. height: 100%;
  383. }
  384. }
  385. .tabBox {
  386. width: 100%;
  387. height: 100%;
  388. display: flex;
  389. align-items: center;
  390. .tabBox_content{
  391. padding-left: 5px;
  392. }
  393. .tabBox_pice {
  394. flex-shrink: 0;
  395. }
  396. .tabBox_img {
  397. width: 30px;
  398. height: 30px;
  399. flex-shrink: 0;
  400. img {
  401. width: 100%;
  402. height: 100%;
  403. }
  404. }
  405. .tabBox_tit {
  406. flex-grow: 1;
  407. font-size: 12px !important;
  408. letter-spacing: 1px;
  409. box-sizing: border-box;
  410. }
  411. }
  412. .tabBox+.tabBox {
  413. margin-top: 5px;
  414. }
  415. .pictrue-box {
  416. display: flex;
  417. align-item: center;
  418. }
  419. .pictrue {
  420. width: 25px;
  421. height: 25px;
  422. }
  423. .flex-search {
  424. display: flex;
  425. }
  426. </style>