list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  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="员工ID:" label-for="title">
  10. <div class='flex-search'>
  11. <Input v-model="pagination.member_id" icon="ios-search" @on-click='openmid' placeholder="请输入员工ID" class="input-add mr14" />
  12. </div>
  13. </FormItem>
  14. <!-- <FormItem label="时间范围:">
  15. <DatePicker :editable="false" @on-change="onchangeTime" :value="timeVal" format="yyyy/MM/dd"
  16. type="daterange" placement="bottom-start" placeholder="自定义时间" class="input-add"
  17. :options="options"></DatePicker>
  18. </FormItem>
  19. <FormItem label="业绩类型:">
  20. <Select v-model="pagination.type" class="input-add">
  21. <Option v-for="(item, index) in num" :value="item.value" :key="index">{{ item.name }}
  22. </Option>
  23. </Select>
  24. </FormItem> -->
  25. <Button type="primary" @click="orderSearch()">查询</Button>
  26. <!-- <FormItem label="订单搜索:" label-for="title">
  27. <Input v-model="pagination.order_id" placeholder="请输入订单号" class="input-add mr14" />
  28. </FormItem> -->
  29. </Form>
  30. </div>
  31. </Card>
  32. <!-- <cards-data :cardLists="cardLists"></cards-data> -->
  33. <Card :bordered="false" dis-hover>
  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.user_phone }}</div>
  44. </template>
  45. <template slot-scope="{ row, index }" slot="user">
  46. <span class="tabBox_pice">{{row.user && row.user.nickname ? row.user.nickname + '(UID:' +row.user.uid+')':''}}</span>
  47. </template>
  48. <template slot-scope="{ row, index }" slot="name">
  49. <span class="tabBox_pice">{{showName(row.member_id)}}</span>
  50. </template>
  51. <template slot-scope="{ row }" slot="info">
  52. <div class="tabBox" v-for="(val, i) in row.info" :key="i">
  53. <div class="tabBox_img" v-viewer>
  54. <img v-lazy="val.slider_image" />
  55. </div>
  56. <span class="tabBox_tit">{{ val.store_name }}</span>
  57. <span class="tabBox_pice">{{'¥' + val.pay_price}}</span>
  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, index }" slot="pay_time">
  70. <span class="tabBox_pice">{{row.create_time| formatDate}}</span>
  71. </template>
  72. <template slot-scope="{ row, index }" slot="action">
  73. <a @click="black(row)" v-if="!row.content">回执</a>
  74. <Divider type="vertical" v-if="!row.content"/>
  75. <a @click="del(row)">删除</a>
  76. </template>
  77. </Table>
  78. <div class="acea-row row-right page">
  79. <Page :total="total" :current="pagination.page" show-elevator show-total @on-change="pageChange"
  80. :page-size="pagination.limit" />
  81. </div>
  82. </Card>
  83. <Modal v-model="modals" width='80' mask title="员工选择">
  84. <staffList :is_reservation='0' @getProductId='checkmember'></staffList>
  85. <template #footer>
  86. <Button @click="memberListShow=false">取消</Button>
  87. </template>
  88. </Modal>
  89. <Modal
  90. v-model="tsmodals"
  91. scrollable
  92. closable
  93. title="回执"
  94. :mask-closable="false"
  95. >
  96. <Input
  97. v-model="msg"
  98. type="textarea"
  99. :rows="4"
  100. placeholder="请输入回执内容"
  101. />
  102. <div slot="footer">
  103. <Button
  104. type="primary"
  105. size="large"
  106. long
  107. :loading="mtsmodals_loading"
  108. @click="oks"
  109. >确定</Button
  110. >
  111. </div>
  112. </Modal>
  113. </div>
  114. </template>
  115. <script>
  116. import {
  117. formatDate
  118. } from '@/utils/validate';
  119. import {
  120. getYgList
  121. } from '@/api/store'
  122. import {
  123. mapState
  124. } from "vuex";
  125. import {
  126. getKpi
  127. } from "@/api/agent"
  128. import {
  129. getDs,
  130. getTs,
  131. tsBack,
  132. delTs
  133. } from "@/api/finance"
  134. import timeOptions from "@/utils/timeOptions";
  135. import cardsData from "@/components/cards/cards";
  136. import staffList from "@/components/staffList/index";
  137. export default {
  138. components: {
  139. cardsData,
  140. staffList
  141. },
  142. filters: {
  143. formatDate(time) {
  144. if (time !== 0) {
  145. let date = new Date(time * 1000);
  146. return formatDate(date, 'yyyy-MM-dd hh:mm');
  147. }
  148. }
  149. },
  150. data() {
  151. return {
  152. blaclItem: {},
  153. msg: '',
  154. mtsmodals_loading: false,
  155. tsmodals: false,
  156. modals:false,
  157. cardLists: [],
  158. thead: [{
  159. title: "id",
  160. align: "id",
  161. key: "id",
  162. minWidth: 50,
  163. }, {
  164. title: "订单编号",
  165. align: "order_id",
  166. key: "order_id",
  167. minWidth: 150,
  168. },
  169. // subscribe_id
  170. {
  171. title: "用户",
  172. align: "user",
  173. slot: "user",
  174. minWidth: 80,
  175. },
  176. {
  177. title: "员工",
  178. align: "name",
  179. slot: "name",
  180. minWidth: 80,
  181. },
  182. {
  183. title: "投诉原因",
  184. key: "reason",
  185. minWidth: 70,
  186. },
  187. {
  188. title: "投诉时间",
  189. slot: "pay_time",
  190. minWidth: 130,
  191. },
  192. {
  193. title: "回执",
  194. key: "content",
  195. minWidth: 130,
  196. },
  197. {
  198. title: "操作",
  199. slot: "action",
  200. // fixed: "right",
  201. minWidth: 100,
  202. },
  203. ],
  204. tbody: [],
  205. num: [{
  206. name: '全部',
  207. value: 0
  208. }, {
  209. name: '销售业绩',
  210. value: 1
  211. },
  212. {
  213. name: '手工业绩',
  214. value: 2
  215. },
  216. ],
  217. loading: false,
  218. total: 0,
  219. pagination: {
  220. type: 0,
  221. member_id: '',
  222. page: 1,
  223. limit: 15,
  224. create_time: "",
  225. status: 0
  226. },
  227. options: timeOptions,
  228. timeVal: [],
  229. name: "",
  230. staffList: []
  231. };
  232. },
  233. computed: {
  234. ...mapState("order", ["orderChartType"]),
  235. // ...mapState("admin/layout", ["isMobile"]),
  236. labelWidth() {
  237. return this.isMobile ? undefined : 96;
  238. },
  239. labelPosition() {
  240. return this.isMobile ? "top" : "right";
  241. },
  242. },
  243. created() {
  244. this.getYgList()
  245. },
  246. methods: {
  247. oks() {
  248. if(this.msg == '' ) {
  249. return this.$Message.error('请输入回执内容');
  250. }
  251. tsBack({
  252. id: this.blaclItem.id,
  253. content: this.msg
  254. }).then(res => {
  255. this.$Message.success(res.msg);
  256. this.blaclItem = {}
  257. this.tsmodals = false;
  258. this.getList();
  259. })
  260. },
  261. black(row) {
  262. this.blaclItem = row;
  263. this.tsmodals = true;
  264. },
  265. del(row) {
  266. let that = this;
  267. this.$Modal.confirm({
  268. title: "确认删除",
  269. content: '<p>确定删除吗?</p><p>删除后将无法恢复,请谨慎操作!</p>',
  270. loading: true,
  271. onOk: () => {
  272. this.$Modal.remove();
  273. delTs(row.id).then(res=> {
  274. that.$Message.success('删除完成');
  275. that.getList();
  276. })
  277. },
  278. onCancel: () => {
  279. // this.$Message.info('取消成功');
  280. }
  281. });
  282. },
  283. getYgList() {
  284. getYgList({
  285. page: 1,
  286. limit:100
  287. }).then(res => {
  288. this.staffList = res.data.list;
  289. this.getOrderList();
  290. })
  291. },
  292. showName(id) {
  293. let obj = {};
  294. obj = this.staffList.find(item => item.id == id)
  295. if(obj && obj.id) {
  296. return obj.name
  297. }else {
  298. return '--'
  299. }
  300. },
  301. // 打开弹窗
  302. openmid(e) {
  303. this.modals = true;
  304. },
  305. // 选中员工
  306. checkmember(res) {
  307. let data = res[0];
  308. this.modals = false;
  309. this.pagination.member_id = data.id;
  310. },
  311. showTime(time) {
  312. var date = new Date(time * 1000);
  313. var year = date.getFullYear(); // 获取年份
  314. var month = ("0" + (date.getMonth() + 1)).slice(-2); // 获取月份(注意月份从 0 开始,需要加 1)
  315. var day = ("0" + date.getDate()).slice(-2); // 获取日期
  316. var hours = ("0" + date.getHours()).slice(-2); // 获取小时
  317. var minutes = ("0" + date.getMinutes()).slice(-2); // 获取分钟
  318. var seconds = ("0" + date.getSeconds()).slice(-2); // 获取秒钟
  319. var dateString = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; // 自定义时间格式
  320. return dateString
  321. },
  322. showPrice(list) {
  323. let price = 0;
  324. list.forEach(item => {
  325. price += item.pay_price * 1
  326. })
  327. return price.toFixed(2)
  328. },
  329. // 具体日期搜索();
  330. onchangeTime(e) {
  331. console.log(e, 'eeeeeee')
  332. this.pagination.page = 1;
  333. this.timeVal = e;
  334. this.pagination.create_time = this.timeVal[0] ? this.timeVal.join("-") : "";
  335. },
  336. // 订单列表
  337. getOrderList() {
  338. this.loading = true;
  339. getTs(this.pagination)
  340. .then((res) => {
  341. this.loading = false;
  342. const {
  343. count,
  344. data,
  345. num
  346. } = res.data;
  347. this.total = count;
  348. this.tbody = data;
  349. })
  350. .catch((err) => {
  351. this.loading = false;
  352. this.$Message.error(err.msg);
  353. });
  354. },
  355. // 分页
  356. pageChange(index) {
  357. this.pagination.page = index;
  358. this.getOrderList();
  359. },
  360. // 订单搜索
  361. orderSearch() {
  362. this.pagination.page = 1;
  363. this.getOrderList();
  364. },
  365. },
  366. };
  367. </script>
  368. <style lang="stylus" scoped>
  369. .span-del {
  370. color: #ed4014;
  371. display: block
  372. }
  373. .code {
  374. position: relative;
  375. }
  376. .QRpic {
  377. width: 180px;
  378. height: 259px;
  379. img {
  380. width: 100%;
  381. height: 100%;
  382. }
  383. }
  384. .tabBox {
  385. width: 100%;
  386. height: 100%;
  387. display: flex;
  388. align-items: center;
  389. .tabBox_img {
  390. width: 30px;
  391. height: 30px;
  392. img {
  393. width: 100%;
  394. height: 100%;
  395. }
  396. }
  397. .tabBox_tit {
  398. width: 245px;
  399. height: 30px;
  400. line-height: 30px;
  401. font-size: 12px !important;
  402. margin: 0 2px 0 10px;
  403. letter-spacing: 1px;
  404. box-sizing: border-box;
  405. }
  406. }
  407. .tabBox+.tabBox {
  408. margin-top: 5px;
  409. }
  410. .pictrue-box {
  411. display: flex;
  412. align-item: center;
  413. }
  414. .pictrue {
  415. width: 25px;
  416. height: 25px;
  417. }
  418. </style>