index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <div id="order-check">
  3. <div class="order-check-body" v-loading.fullscreen.lock="fullscreenLoading">
  4. <div class="order-management-body">
  5. <div class="order-management-inner">
  6. <span>下单时间:</span>
  7. <el-date-picker size="large" v-model="searchDate" type="daterange" unlink-panels range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions2" value-format="yyyy-MM-dd" align="center">
  8. </el-date-picker>
  9. <!-- <span>支付平台交易号:</span>
  10. <el-input @keyup.enter.native="_searchOrderData(1)" ref="searchTradeNum" v-model="searchTradeNum" value="" placeholder="交易号"></el-input> -->
  11. <div class="base-info">
  12. <span>订单号:</span>
  13. <el-input @keyup.enter.native="_searchOrderData(1)" ref="searchOrderNumber" v-model="searchOrderNumber" value="" placeholder="订单号"></el-input>
  14. <span>手机号:</span>
  15. <el-input @keyup.enter.native="_searchOrderData(1)" ref="searchPhone" v-model="searchPhone" value="" placeholder="手机号"></el-input>
  16. <span>支付平台交易号:</span>
  17. <el-input @keyup.enter.native="_searchOrderData(1)" ref="searchTradeNum" v-model="searchTradeNum" value="" placeholder="支付平台交易号:"></el-input>
  18. <el-button type="primary" @click="_searchOrderData(1)" color='red'>筛选</el-button>
  19. </div>
  20. </div>
  21. <div class="order-check_bottom">
  22. <div class="order-management-table">
  23. <div class="order-check_tab">
  24. <ul>
  25. <!-- <li v-for="(item,index) in tabs" :key="index" :class="{'order-check_tab_li_active':item.idx==tabIndex}" @click="clickTabItem(item.idx)">{{item.name}}<span v-if="item.idx != 3" style="margin:0 10px;color: #999;font-weight: normal;">/</span></li> -->
  26. </ul>
  27. <div style="float: right;vertical-align: middle;">
  28. <!-- <el-select v-model="selectValue" placeholder="请选择">
  29. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
  30. </el-option>
  31. </el-select> -->
  32. <el-button type="primary" @click="_exportExcelForOrder" color='red'>导出</el-button>
  33. </div>
  34. </div>
  35. <el-table ref="order_table" @expand-change="_getOrderDetail" class='e-table' :data="orders" style="width: 100%">
  36. <el-table-column label="下单时间">
  37. <template slot-scope="scope">
  38. <div>{{new Date(scope.row.orderTime).format('yyyy-MM-dd hh:mm:ss')}}</div>
  39. </template>
  40. </el-table-column>
  41. <el-table-column prop="orderSn" label="订单号">
  42. </el-table-column>
  43. <el-table-column prop="userName" label="手机号/用户名">
  44. </el-table-column>
  45. <el-table-column v-if="routeName == '下载订单'" prop="snCode" label="相机SN">
  46. </el-table-column>
  47. <el-table-column v-if="routeName == '下载订单'" prop="sceneName" label="场景下载">
  48. <template slot-scope="scope">
  49. <div>{{scope.row.sceneName}}({{scope.row.sceneNum}})</div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column v-if="routeName == '权益订单'" prop="goodsNum" label="数量">
  53. </el-table-column>
  54. <el-table-column prop="totalAmount" label="订单金额(元)">
  55. </el-table-column>
  56. <el-table-column prop="paymentTypeName" label="支付方式">
  57. <template slot-scope="scope">
  58. <div>{{payMap[scope.row.paymentTypeName]}}</div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column prop="tradeNum" label="支付平台交易号">
  62. </el-table-column>
  63. <el-table-column prop="orderStatus" label="订单状态">
  64. <template slot-scope="scope">
  65. <div>{{paymentStatusMap[scope.row.paymentStatus]}}</div>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. </div>
  70. <div class="order-management-pagination">
  71. <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="10" layout="total, prev, pager, next, jumper" :total="total">
  72. </el-pagination>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </template>
  79. <script>
  80. export default {
  81. name: 'order-check',
  82. data () {
  83. return {
  84. routeName:'',
  85. payMap: {
  86. '0': '微信',
  87. '1': '支付宝',
  88. '2': 'paypal',
  89. '3': '其他',
  90. '4': '货到付款'
  91. },
  92. paymentStatusMap: {
  93. unpaid: '未付款',
  94. paid: '已付款',
  95. cancel: '已取消',
  96. partPayment: '部分支付',
  97. partRefund: '部分退款',
  98. refunded: '全额退款'
  99. },
  100. tabs: [{ name: '全部', idx: -1 }, { name: '未支付', idx: 0 }, { name: '待发货', idx: 1 }, { name: '已发货', idx: 2 }, { name: '已完成', idx: 3 }],
  101. expandedArr: [],
  102. orders: [],
  103. currentPage: 1,
  104. key_input: '',
  105. fullscreenLoading: false,
  106. product: {
  107. 'name': '',
  108. 'packageName': '',
  109. 'count': '',
  110. 'amount': '',
  111. 'url': ''
  112. },
  113. receive: {
  114. 'name': '',
  115. 'phone': '',
  116. 'address': '',
  117. 'invoice': '',
  118. 'expressNum': ''
  119. },
  120. total: 0,
  121. options: [{
  122. value: undefined,
  123. label: '全部筛选订单'
  124. }, {
  125. value: 0,
  126. label: '未支付筛选订单'
  127. }, {
  128. value: 1,
  129. label: '待发货筛选订单'
  130. }, {
  131. value: 2,
  132. label: '已发货筛选订单'
  133. }, {
  134. value: 3,
  135. label: '已完成筛选订单'
  136. }],
  137. selectValue: '',
  138. // expressNum_input: "",
  139. searchDate: [],
  140. searchOrderNumber: '',
  141. searchTradeNum:'',
  142. searchPhone: '',
  143. searchExpressNum: '',
  144. hasClickSearch: false,
  145. tabIndex: -1,
  146. pickerOptions2: {
  147. shortcuts: [{
  148. text: '最近一周',
  149. onClick (picker) {
  150. const end = new Date()
  151. const start = new Date()
  152. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
  153. picker.$emit('pick', [start, end])
  154. }
  155. }, {
  156. text: '最近一个月',
  157. onClick (picker) {
  158. const end = new Date()
  159. const start = new Date()
  160. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
  161. picker.$emit('pick', [start, end])
  162. }
  163. }, {
  164. text: '最近三个月',
  165. onClick (picker) {
  166. const end = new Date()
  167. const start = new Date()
  168. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
  169. picker.$emit('pick', [start, end])
  170. }
  171. }]
  172. }
  173. }
  174. },
  175. watch: {
  176. '$route' (to, from) {
  177. this.routeName = this.$route.meta.text
  178. //to.path即为将要进入的路由
  179. this.selectValue = ''
  180. this.searchDate = []
  181. this.searchOrderNumber = ''
  182. this.searchTradeNum = ''
  183. this.searchPhone = ''
  184. this.searchExpressNum = ''
  185. this.currentPage = 1
  186. this._searchOrderData(1)
  187. }
  188. },
  189. methods: {
  190. handleClick (row) {
  191. console.log(this.status)
  192. console.log(this.selectValue)
  193. },
  194. hideRow (row) {
  195. this.$refs.order_table.toggleRowExpansion(row, false)
  196. },
  197. handleCurrentChange (val) {
  198. let page = val
  199. if (this.total > 0 && !this.hasClickSearch) {
  200. this._searchOrderData(page)
  201. } else {
  202. this._searchOrderData(page)
  203. }
  204. },
  205. clickTabItem (idx) {
  206. this.tabIndex = idx
  207. this.hasClickSearch = false
  208. this.total = 0
  209. this.currentPage = 1
  210. this.status = this.tabIndex === -1 ? null : this.tabIndex
  211. if (!this.searchDate || this.expressNum || !this.userName || !this.orderNum) {
  212. this._searchOrderData()
  213. }
  214. },
  215. async _searchOrderData (page) {
  216. this.hasClickSearch = true
  217. let date1, date2, userName, expressNum, orderNum,tradeNum
  218. this.date1 = this.searchDate ? this.searchDate[0] : null
  219. this.date2 = this.searchDate ? this.searchDate[1] : null
  220. date1 = this.date1 ? (this.date1 + ' 00:00:00') : null
  221. date2 = this.date2 ? (this.date2 + ' 23:59:59') : null
  222. this.userName = userName = this.searchPhone || null
  223. this.expressNum = expressNum = this.searchExpressNum || null
  224. this.orderNum = orderNum = this.searchOrderNumber || null
  225. this.tradeNum = tradeNum = this.searchTradeNum || null
  226. // console.log(searchDate,searchPhone,searchExpressNum,searchOrderNumber)
  227. this.fullscreenLoading = true
  228. let status = this.status
  229. let data = (await this.$http.post(this.geturl('list'), {
  230. pageNum: page,
  231. type: status,
  232. startDate: date1,
  233. endDate: date2,
  234. orderSn: orderNum,
  235. phoneNum: userName,
  236. expressNum,
  237. tradeNum,
  238. pageSize: 10
  239. })).data
  240. this.fullscreenLoading = false
  241. let temp = data.list
  242. for (var i = 0; i < temp.length; i++) {
  243. // temp[i]['expressNum_input'] = "";
  244. temp[i].items = []
  245. }
  246. this.orders = temp
  247. this.currentPage = page
  248. this.total = data.total
  249. },
  250. _exportExcelForOrder () {
  251. let date1, date2, userName, expressNum, orderNum,tradeNum
  252. this.date1 = this.searchDate ? this.searchDate[0] : null
  253. this.date2 = this.searchDate ? this.searchDate[1] : null
  254. date1 = this.date1 ? (this.date1 + ' 00:00:00') : null
  255. date2 = this.date2 ? (this.date2 + ' 23:59:59') : null
  256. this.userName = userName = this.searchPhone || null
  257. this.expressNum = expressNum = this.searchExpressNum || null
  258. this.orderNum = orderNum = this.searchOrderNumber || null
  259. this.tradeNum = tradeNum = this.searchTradeNum || null
  260. let data = {
  261. 'type': this.status,
  262. 'startDate': date1,
  263. 'endDate': date2,
  264. 'orderSn': orderNum,
  265. 'phoneNum': userName,
  266. 'expressNum': expressNum,
  267. 'tradeNum':tradeNum
  268. }
  269. this.fullscreenLoading = true
  270. console.error(data)
  271. this.$confirm('确定当前标签下的订单记录?', '导出订单', {
  272. confirmButtonText: '确定',
  273. cancelButtonText: '取消',
  274. type: 'warning'
  275. }).then(async () => {
  276. let exec = await this.$http({
  277. methods: 'get',
  278. params: data,
  279. url: this.geturl('export'),//'/manager/order/export',
  280. responseType: 'arraybuffer'
  281. })
  282. try {
  283. let blob = new Blob([exec], {type: 'application/vnd.ms-excel'})
  284. let url = URL.createObjectURL(blob)
  285. location.href = url
  286. } catch (e) {
  287. console.error(e)
  288. }
  289. this.fullscreenLoading = false
  290. }).catch(() => {
  291. this.$message({
  292. type: 'info',
  293. message: '已取消导出'
  294. })
  295. this.fullscreenLoading = false
  296. })
  297. },
  298. geturl(name){
  299. let urlname = this.$route.name == 'qyOrder'?'incrementOrder':'downloadOrder'
  300. let download = {
  301. list:`/manager/${urlname}/list`,
  302. export:`/manager/${urlname}/export`,
  303. }
  304. return download[name]
  305. },
  306. async _getOrderDetail (row) {
  307. this.fullscreenLoading = true
  308. let data = (await this.$http.post('/manager/order/detail', {orderId: row.id})).data
  309. let temp = this.orders.find(item => item.id === row.id)
  310. temp.items = data.orderItems.map(item => {
  311. return {
  312. ...item,
  313. product: {
  314. url: item.pic,
  315. name: item.goodsName,
  316. packageName: item.description,
  317. count: item.goodsCount,
  318. amount: item.goodsPrice
  319. },
  320. receive: {
  321. name: data.shipName,
  322. phone: data.shipMobile,
  323. address: data.shipAddress,
  324. invoice: data.invoice,
  325. expressNum: item.expressNum,
  326. expressName: item.expressName
  327. }
  328. }
  329. })
  330. console.log(temp)
  331. this.fullscreenLoading = false
  332. }
  333. },
  334. mounted () {
  335. // console.log(window.location.origin)
  336. // window.open(window.location.origin+'/main')
  337. this.routeName = this.$route.meta.text
  338. this._searchOrderData(1)
  339. }
  340. }
  341. </script>
  342. <style scoped>
  343. @import url('./style.css');
  344. .el-icon-s-flag {
  345. cursor: pointer;
  346. }
  347. </style>
  348. <style type="text/css">
  349. .el-table__expand-icon--expanded {
  350. transform: rotate(0) !important;
  351. }
  352. .el-table__expand-icon>i {
  353. display: none !important;
  354. }
  355. .el-table__expand-icon:after {
  356. content: "\8BE6\7EC6";
  357. color: #09e1c0;
  358. cursor: pointer;
  359. }
  360. </style>