index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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 filterable clearable v-model="pagination.member_id" class="input-add">
  11. <Option v-for="(item, index) in ygList" :value="item.id" :key="index">{{ item.name }}(ID:{{item.uid}})
  12. </Option>
  13. </Select>
  14. </FormItem>
  15. <FormItem label="时间范围:">
  16. <DatePicker :editable="false" @on-change="onchangeTime" :value="timeVal" format="yyyy/MM/dd"
  17. type="daterange" placement="bottom-start" placeholder="自定义时间" class="input-add"
  18. :options="options"></DatePicker>
  19. </FormItem>
  20. <FormItem label="业绩类型:">
  21. <Select v-model="pagination.type" class="input-add">
  22. <Option v-for="(item, index) in num" :value="item.value" :key="index">{{ item.name }}
  23. </Option>
  24. </Select>
  25. <Button type="primary" @click="orderSearch()">查询</Button>
  26. </FormItem>
  27. <!-- <FormItem label="订单搜索:" label-for="title">
  28. <Input v-model="pagination.order_id" placeholder="请输入订单号" class="input-add mr14" />
  29. </FormItem> -->
  30. </Form>
  31. </div>
  32. </Card>
  33. <cards-data :cardLists="cardLists"></cards-data>
  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. <span class="tabBox_tit">{{ val.store_name }}</span>
  55. <span class="tabBox_pice">{{'¥' + val.pay_price}}</span>
  56. </div>
  57. </template>
  58. <template slot-scope="{ row, index }" slot="pay_price">
  59. <span class="tabBox_pice">{{'¥' + showPrice(row.info)}}</span>
  60. </template>
  61. <template slot-scope="{ row, index }" slot="reservation_time">
  62. <span class="tabBox_pice">{{showTime(row.reservation_time)}}</span>
  63. </template>
  64. <template slot-scope="{ row, index }" slot="store">
  65. <span class="tabBox_pice">{{row.store.name}}</span>
  66. </template>
  67. <template slot-scope="{ row }" slot="type">
  68. <span v-if="row.type == 1">销售业绩</span>
  69. <span v-if="row.type == 2">手工业绩</span>
  70. </template>
  71. <template slot-scope="{ row, index }" slot="add_time">
  72. <span class="tabBox_pice">{{showTime(row.add_time)}}</span>
  73. </template>
  74. </Table>
  75. <div class="acea-row row-right page">
  76. <Page :total="total" :current="pagination.page" show-elevator show-total @on-change="pageChange"
  77. :page-size="pagination.limit" />
  78. </div>
  79. </Card>
  80. <Modal v-model="modals" scrollable title="选择员工" class="order_box" :closable="false">
  81. <Form :label-width="80">
  82. <FormItem label="员工:" prop="chooseId">
  83. <Select v-model="chooseId" style="width: 250px">
  84. <Option v-for="item in ygList" :key="item.id" :value="item.id">{{ item.name }}</Option>
  85. </Select>
  86. </FormItem>
  87. </Form>
  88. <div slot="footer">
  89. <Button type="primary" @click="goCancal">提交</Button>
  90. <Button @click="cancal">取消</Button>
  91. </div>
  92. </Modal>
  93. </div>
  94. </template>
  95. <script>
  96. import {
  97. mapState
  98. } from "vuex";
  99. import {
  100. member_update
  101. } from "@/api/order";
  102. import {
  103. getYgList
  104. } from "@/api/store"
  105. import {
  106. getKpi
  107. } from "@/api/agent"
  108. import timeOptions from "@/utils/timeOptions";
  109. import cardsData from "@/components/cards/cards";
  110. export default {
  111. components: {
  112. cardsData
  113. },
  114. data() {
  115. return {
  116. cardLists: [],
  117. modals: false,
  118. order_id: '',
  119. ygList: [],
  120. chooseId: 0,
  121. openErp: false,
  122. thead: [{
  123. title: "id",
  124. align: "id",
  125. key: "id",
  126. minWidth: 50,
  127. }, {
  128. title: "服务订单号",
  129. align: "order_id",
  130. key: "order_id",
  131. minWidth: 150,
  132. },
  133. {
  134. title: "员工",
  135. align: "name",
  136. key: "name",
  137. minWidth: 80,
  138. },
  139. {
  140. title: "员工手机",
  141. key: "mobile",
  142. minWidth: 100,
  143. },
  144. {
  145. title: "业绩值变动",
  146. key: "performance",
  147. minWidth: 70,
  148. },
  149. {
  150. title: "业绩值分类",
  151. slot: "type",
  152. minWidth: 70,
  153. },
  154. {
  155. title: "详情",
  156. key: "content",
  157. minWidth: 150,
  158. },
  159. {
  160. title: "业绩变动后",
  161. key: "balance",
  162. minWidth: 70,
  163. },
  164. {
  165. title: "更新时间",
  166. key: "create_time",
  167. minWidth: 130,
  168. },
  169. ],
  170. tbody: [],
  171. num: [{
  172. name: '全部',
  173. value: 0
  174. }, {
  175. name: '销售业绩',
  176. value: 1
  177. },
  178. {
  179. name: '手工业绩',
  180. value: 2
  181. },
  182. ],
  183. orderDatalist: null,
  184. loading: false,
  185. FromData: null,
  186. total: 0,
  187. orderId: 0,
  188. animal: 1,
  189. pagination: {
  190. type: 0,
  191. member_id: 0,
  192. page: 1,
  193. limit: 15,
  194. order_id: "",
  195. create_time: "",
  196. status: 0
  197. },
  198. options: timeOptions,
  199. timeVal: [],
  200. modal: false,
  201. qrcode: null,
  202. name: "",
  203. spin: false,
  204. rowActive: {},
  205. };
  206. },
  207. computed: {
  208. ...mapState("order", ["orderChartType"]),
  209. // ...mapState("admin/layout", ["isMobile"]),
  210. labelWidth() {
  211. return this.isMobile ? undefined : 96;
  212. },
  213. labelPosition() {
  214. return this.isMobile ? "top" : "right";
  215. },
  216. },
  217. created() {
  218. this.getYgList()
  219. this.getOrderList();
  220. },
  221. methods: {
  222. showName(id) {
  223. let yg = this.ygList.find(item => {
  224. return item.id == id
  225. })
  226. return yg ? yg.name : ''
  227. },
  228. getYgList() {
  229. getYgList({
  230. page: 1,
  231. limit: 1000
  232. }).then(res => {
  233. this.ygList = res.data.list
  234. })
  235. },
  236. showTime(time) {
  237. var date = new Date(time * 1000);
  238. var year = date.getFullYear(); // 获取年份
  239. var month = ("0" + (date.getMonth() + 1)).slice(-2); // 获取月份(注意月份从 0 开始,需要加 1)
  240. var day = ("0" + date.getDate()).slice(-2); // 获取日期
  241. var hours = ("0" + date.getHours()).slice(-2); // 获取小时
  242. var minutes = ("0" + date.getMinutes()).slice(-2); // 获取分钟
  243. var seconds = ("0" + date.getSeconds()).slice(-2); // 获取秒钟
  244. var dateString = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; // 自定义时间格式
  245. return dateString
  246. },
  247. showPrice(list) {
  248. let price = 0;
  249. list.forEach(item => {
  250. price += item.pay_price * 1
  251. })
  252. return price.toFixed(2)
  253. },
  254. // 具体日期搜索();
  255. onchangeTime(e) {
  256. console.log(e, 'eeeeeee')
  257. this.pagination.page = 1;
  258. this.timeVal = e;
  259. this.pagination.create_time = this.timeVal[0] ? this.timeVal.join("-") : "";
  260. },
  261. cancal() {
  262. this.modals = false
  263. this.remark = ''
  264. },
  265. //goCancal
  266. goCancal() {
  267. if (this.chooseId == '') {
  268. return this.$Message.error('请选择员工')
  269. }
  270. this.modals = false
  271. member_update({
  272. id: this.order_id,
  273. work_member_id: this.chooseId
  274. }).then(res => {
  275. this.$Message.success(res.msg)
  276. this.getOrderList()
  277. }).catch(err => {
  278. this.$Message.error(err.msg)
  279. })
  280. },
  281. // 订单列表
  282. getOrderList() {
  283. this.loading = true;
  284. getKpi(this.pagination)
  285. .then((res) => {
  286. this.loading = false;
  287. const {
  288. count,
  289. list,
  290. num
  291. } = res.data;
  292. this.total = count;
  293. this.tbody = list;
  294. this.cardLists = [{
  295. col: 6,
  296. count: res.data.sale_sum,
  297. name: "销售总业绩",
  298. className: "md-basket",
  299. },
  300. {
  301. col: 6,
  302. count: res.data.craft_sum,
  303. name: "手工总业绩",
  304. className: "md-pricetags",
  305. }];
  306. // this.num = num;
  307. list.forEach((item) => {
  308. if (item.id == this.orderId) {
  309. this.rowActive = item;
  310. }
  311. });
  312. })
  313. .catch((err) => {
  314. this.loading = false;
  315. this.$Message.error(err.msg);
  316. });
  317. },
  318. // 分页
  319. pageChange(index) {
  320. this.pagination.page = index;
  321. this.getOrderList();
  322. },
  323. // 订单搜索
  324. orderSearch() {
  325. this.pagination.page = 1;
  326. this.getOrderList();
  327. },
  328. },
  329. };
  330. </script>
  331. <style lang="stylus" scoped>
  332. .span-del {
  333. color: #ed4014;
  334. display: block
  335. }
  336. .code {
  337. position: relative;
  338. }
  339. .QRpic {
  340. width: 180px;
  341. height: 259px;
  342. img {
  343. width: 100%;
  344. height: 100%;
  345. }
  346. }
  347. .tabBox {
  348. width: 100%;
  349. height: 100%;
  350. display: flex;
  351. align-items: center;
  352. .tabBox_img {
  353. width: 30px;
  354. height: 30px;
  355. img {
  356. width: 100%;
  357. height: 100%;
  358. }
  359. }
  360. .tabBox_tit {
  361. width: 245px;
  362. height: 30px;
  363. line-height: 30px;
  364. font-size: 12px !important;
  365. margin: 0 2px 0 10px;
  366. letter-spacing: 1px;
  367. box-sizing: border-box;
  368. }
  369. }
  370. .tabBox+.tabBox {
  371. margin-top: 5px;
  372. }
  373. .pictrue-box {
  374. display: flex;
  375. align-item: center;
  376. }
  377. .pictrue {
  378. width: 25px;
  379. height: 25px;
  380. }
  381. </style>