index.vue 9.6 KB

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