企微助手 ,仓库名 短剧

yxOrderData.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <template>
  2. <div>
  3. <div class="screenBox">
  4. <div class="flex-align-center" style="flex-wrap: wrap;margin-right: 60px;">
  5. <datePicker title="" :quickFlag="true" :afferent_time="default_time" :clearFlag='false' :reset="resetFlag" @changeTime="onChangeTime" style="margin-right: 10px;" />
  6. <selfInput style="margin-right: 10px;" width="220px" :hasLabel="false" :reset="resetFlag" label_name="订单ID" @inputChange='onInputOrderId' @onChange="onChangeOrderId" />
  7. <selfChannelMultiple style="margin-right: 10px;" title="" type='adqAccount' :reset="resetFlag" :labelWidth="true" @channelDefine="onChangeAccountId" />
  8. <selfInput style="margin-right: 10px;" width="220px" :hasLabel="false" :reset="resetFlag" label_name="自定义参数" @inputChange="onInputCpsId" @onChange="onChangeCpsId" />
  9. <!-- <selfChannel style="margin-right: 10px;" title="" type="" :reset="resetFlag" :labelWidth="true" @onChange="onChangeOrderStatus"/> -->
  10. </div>
  11. <div class="reset" @click="resetEvent">重置</div>
  12. <!-- <el-button v-if="isCanExport" class="export-btn" type="primary" size="mini" @click="onClickExport">导出Excel</el-button> -->
  13. </div>
  14. <div v-loading="loading">
  15. <ux-grid class="uxGridBox" ref="plxTable" :border="false" @row-click="() => { return }"
  16. :header-cell-style="headerColor" :height="height" show-footer-overflow="tooltip" show-overflow="tooltip"
  17. size="mini">
  18. <ux-table-column v-for="item in desCol" :key="item.prop" :resizable="true" :field="item.prop"
  19. :title="item.label" :min-width="item.min_width ? item.min_width : 120" :fixed="item.fixed ? item.fixed : ''"
  20. align="center">
  21. <template #header>
  22. <div class="flex-align-jus-center">{{ item.label }}
  23. <el-tooltip v-if="item.notes" :content="item.notes" placement="top">
  24. <div><i class="el-icon-question"></i></div>
  25. </el-tooltip>
  26. </div>
  27. </template>
  28. <template v-slot="{ row, $index }">
  29. <div v-if="item.prop == 'actionBtn'">
  30. <template>
  31. <span v-if="row.ad_report_order_status == '成功'" class="c-A5A5A5 pointer fWeight600 disabled">已回传</span>
  32. <span v-else-if="row.order_status != 4 && row.predict_commission_fee > 0" class="c-00B38A pointer fWeight600" @click="onClickReport(row)">回传</span>
  33. </template>
  34. </div>
  35. <span v-else-if="item.prop == 'order_id'">
  36. {{ row[item.prop] || row[item.prop] == 0 ? row[item.prop] : '-' }}
  37. </span>
  38. <span v-else-if="item.prop == 'account_id'">
  39. {{ row[item.prop] || row[item.prop] == 0 ? row[item.prop] : '-' }}
  40. </span>
  41. <span v-else>{{ (row[item.prop] || row[item.prop] == 0) && row[item.prop] != '' ? $formatNum(row[item.prop])
  42. : '-'
  43. }}</span>
  44. </template>
  45. </ux-table-column>
  46. </ux-grid>
  47. <div class="pagination" v-show="total > 0">
  48. <el-pagination
  49. background :current-page="page"
  50. layout="prev, pager, next, sizes, jumper"
  51. :page-sizes="[20, 50, 100]" :page-count='Number(pages)'
  52. @current-change="handleCurrentChange" @size-change="handleSizeChange"
  53. />
  54. </div>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import datePicker from '@/components/assembly/screen/datePicker.vue'
  60. import selfChannel from '@/components/assembly/screen/channel.vue'
  61. import selfInput from '@/components/assembly/screen/input.vue'
  62. import selfChannelV2 from '@/components/assembly/screen/channelV2.vue'
  63. import selfChannelMultiple from '@/components/assembly/screen/channelMultiple.vue'
  64. import { incomeSourceDesc, launchTypeDesc } from '@/assets/js/staticTypes'
  65. export default {
  66. name: 'orderData',
  67. components: {
  68. datePicker,
  69. selfChannel,
  70. selfInput,
  71. selfChannelV2,
  72. selfChannelMultiple,
  73. },
  74. data () {
  75. return {
  76. dataLoading: false,
  77. loading: false,
  78. page: 1,
  79. pages: 0,
  80. total: 0,
  81. page_size: 20,
  82. default_time: [this.$getDay(0, false), this.$getDay(0, false)],
  83. height: '',
  84. resetFlag: false,
  85. dataInfo_stat: {},
  86. trendX: [],
  87. trendData: {
  88. key: 1,
  89. dds: [],
  90. zfje: []
  91. },
  92. desCol: [
  93. { prop: "id", label: "订单编号",fixed: 'left' },
  94. { prop: "order_id", label: "订单ID", min_width: 180 },
  95. { prop: "payment_amount", label: "实际支付金额"},
  96. { prop: "predict_commission_fee", label: "预估佣金" },
  97. { prop: "payed_time", label: "支付时间", min_width: 160 },
  98. { prop: "predict_report_time", label: "预估回传时间", min_width: 160 },
  99. { prop: "order_status_desc", label: "订单状态"},
  100. // { prop: "goods_name", label: "商品名称"},
  101. { prop: "account_id", label: "投放账户", },
  102. { prop: "tx_cps_id", label: "自定义参数"},
  103. { prop: "ad_report_action_type", label: "回传类型"},
  104. { prop: "ad_report_order_status", label: "回传状态"},
  105. { prop: "adgroup_name", label: "回传广告名称"},
  106. { prop: "actionBtn", label: "操作", fixed: 'right' },
  107. ],
  108. filter: {
  109. time: [],
  110. order_id: '', // 订单ID
  111. order_status: '', // 支付状态
  112. account_id: [], // ADQ账号
  113. money: [], // 预估佣金
  114. cps_id: '',// 自定义参数
  115. },
  116. }
  117. },
  118. computed: {
  119. // 是否有“导出”权限
  120. isCanExport() {
  121. return !!this.$store.state.dataBoardAuth.can_export
  122. },
  123. },
  124. created () {
  125. this.height = document.documentElement.clientHeight - 280 > 400 ? document.documentElement.clientHeight - 280 : 400
  126. this.filter.time = this.default_time
  127. this.init(1)
  128. // this.init_predata()
  129. },
  130. methods: {
  131. getIncomeSourceDesc(code) {
  132. if (code || code === 0) {
  133. return incomeSourceDesc[code] || '-'
  134. } else {
  135. return '-'
  136. }
  137. },
  138. getLaunchTypeDesc(code) {
  139. if (code || code === 0) {
  140. return launchTypeDesc[code] || '-'
  141. } else {
  142. return '-'
  143. }
  144. },
  145. headerColor ({ row, column, rowIndex, columnIndex }) {
  146. return { backgroundColor: '#FFFFFF !important', border: 'none!important' }
  147. },
  148. initCharts () {
  149. let myChart = this.$echarts.init(this.$refs.chart);
  150. myChart.setOption({
  151. xAxis: {
  152. show: false,
  153. boundaryGap: false,
  154. data: this.trendX
  155. },
  156. yAxis: {
  157. show: false
  158. },
  159. grid: {
  160. top: 0,
  161. left: 0,
  162. right: 0,
  163. bottom: '1%'
  164. },
  165. series: [{
  166. name: '订单数',
  167. type: 'line',
  168. data: this.trendData.dds,
  169. color: '#00B38A',
  170. }, {
  171. name: '支付金额',
  172. type: 'line',
  173. data: this.trendData.zfje,
  174. color: '#FF8704',
  175. }]
  176. });
  177. },
  178. async init_predata () {
  179. const url = this.URL.BASEURL + this.URL.charge_pre_data
  180. const params = {
  181. start_date: this.filter.time[0],
  182. end_date: this.filter.time[1],
  183. account_id: this.filter.account_id.join(','),
  184. }
  185. try {
  186. this.dataLoading = true
  187. const { data: res = {} } = await this.$axios.post(url, params)
  188. if (res && res.errno == 0) {
  189. this.dataInfo_stat = res.rst.data.stat;
  190. this.trendX = []
  191. this.trendData.dds = []
  192. this.trendData.zfje = []
  193. res.rst.data.trend.forEach(i => {
  194. this.trendX.push(i.ref_date)
  195. this.trendData.dds.push(i.order_count)
  196. this.trendData.zfje.push(i.pay_money)
  197. })
  198. this.trendData.key += 1
  199. } else if (res.errno != 4002) {
  200. this.$message({
  201. message: res.err,
  202. type: "warning"
  203. })
  204. }
  205. } catch (error) {
  206. console.log('error => ', error)
  207. } finally {
  208. this.dataLoading = false
  209. }
  210. },
  211. async init (page, type) {
  212. this.page = page ? page : this.page;
  213. this.loading = true
  214. const url = `${this.URL.BASEURL}${this.URL.dataBoard_orderData_yxOrderList}`
  215. const params = {
  216. order_id: this.filter.order_id,
  217. start_date: this.filter.time[0],
  218. end_date: this.filter.time[1],
  219. account_id: this.filter.account_id.join(','),
  220. order_status: this.filter.order_status,
  221. tx_cps_id: this.filter.cps_id,
  222. sys_group_id: this.$cookie.getCookie('isSuperManage') == 1 ? sessionStorage.getItem('company_session_defaultCorp_level_1').toString() : '',
  223. page: this.page,
  224. page_size: this.page_size,
  225. }
  226. try {
  227. const { data: res = {} } = await this.$axios.get(url, { params })
  228. if (res && res.errno == 0) {
  229. this.datas = res.rst.data // 知道为啥datas不在 data()方法里面定义吗?嘻嘻
  230. this.$refs.plxTable.reloadData(this.datas)
  231. this.total = res.rst.pageInfo.total;
  232. this.pages = res.rst.pageInfo.pages;
  233. } else if (res.errno != 4002) {
  234. this.$message.warning(res.err)
  235. }
  236. } catch (error) {
  237. console.log('error => ', error)
  238. } finally {
  239. this.loading = false
  240. }
  241. },
  242. // 支付状态变化
  243. onChangeOrderStatus(val) {
  244. this.filter.order_status = val;
  245. this.init(1);
  246. // this.init_predata;
  247. },
  248. //筛选时间变化
  249. onChangeTime(time) {
  250. if (!time || time && time.length == 0) {
  251. this.filter.time = []
  252. } else {
  253. this.filter.time = time
  254. }
  255. // this.init_predata()
  256. this.init(1)
  257. },
  258. onInputOrderId(val) {
  259. this.filter.order_id = val
  260. this.init(1)
  261. },
  262. onChangeOrderId(val) {
  263. this.filter.order_id = val
  264. },
  265. onInputCpsId(val) {
  266. this.filter.cps_id = val
  267. this.init(1)
  268. },
  269. onChangeCpsId(val) {
  270. this.filter.cps_id = val
  271. },
  272. onChangePlatOrderType(val) {
  273. this.filter.plat_order_type = val;
  274. this.init(1);
  275. // this.init_predata()
  276. },
  277. onChangeAccountId(val) {
  278. this.filter.account_id = val;
  279. this.init(1);
  280. // this.init_predata();
  281. },
  282. handleCurrentChange (val) {
  283. this.init(val)
  284. },
  285. handleSizeChange (page_size) {
  286. this.page_size = page_size
  287. this.init(1)
  288. },
  289. resetEvent () {//重置
  290. this.resetFlag = !this.resetFlag
  291. this.system_enterprise = []
  292. this.enterprise = {}
  293. this.filter.time = [this.$getDay(-30, false), this.$getDay(0, false)]
  294. this.filter.order_id = ''
  295. this.filter.account_id = []
  296. // this.init_predata()
  297. this.init(1)
  298. },
  299. async onClickReport(row) {
  300. try {
  301. await this.$confirm(`订单ID【${row.order_id}】,确定手动回传吗?`, '提示', {
  302. confirmButtonText: '确定',
  303. cancelButtonText: '取消',
  304. type: 'warning'
  305. })
  306. this.handleReport(row)
  307. } catch (error) {
  308. console.log(error)
  309. }
  310. },
  311. async handleReport({ order_id, id }) {
  312. try {
  313. this.loading = true
  314. const url = `${this.URL.BASEURL}${this.URL.dataBoard_orderData_yxOrderActionReport}`
  315. const params = {
  316. order_id,
  317. order_data_id: id,
  318. }
  319. const { data: res = {} } = await this.$axios.get(url,{ params })
  320. if (res && res.errno == 0) {
  321. this.$message.success('操作成功')
  322. this.init()
  323. } else if (res.errno != 4002) {
  324. this.$message.warning(res.err || '操作失败')
  325. }
  326. } catch (error) {
  327. console.log(error)
  328. } finally {
  329. this.loading = false
  330. }
  331. },
  332. // 监听点击"导出" - 离线导出
  333. async onClickExport() {
  334. try {
  335. await this.$confirm(`确定根据当前筛选条件导出报表吗?`, '提示', {
  336. confirmButtonText: '确定',
  337. cancelButtonText: '取消',
  338. type: 'warning'
  339. })
  340. this.handleCreateOrderExport()
  341. } catch (error) {
  342. console.log('error => ', error)
  343. }
  344. },
  345. // 创建订单离线导出任务
  346. async handleCreateOrderExport() {
  347. try {
  348. this.loading = true
  349. const url = `${this.URL.BASEURL}${this.URL.dataBoard_orderData_orderExportOffline}`
  350. const params = {
  351. sys_group_id: this.$cookie.getCookie('isSuperManage') == 1 ? sessionStorage.getItem('company_session_defaultCorp_level_1').toString() : '',
  352. start_date: this.filter.time[0],
  353. end_date: this.filter.time[1],
  354. order_id: this.filter.order_id,
  355. account_id: this.filter.account_id.join(','),
  356. }
  357. const { data: res = {} } = await this.$axios.get(url, { params })
  358. if (res && res.errno == 0) {
  359. this.$alert('导出预约成功,请稍候到【导出列表】下载文件!', '提示', {
  360. confirmButtonText: '知道了',
  361. type: 'success',
  362. })
  363. } else if (res.errno != 4002) {
  364. this.$message.warning(res.err || '操作失败')
  365. }
  366. } catch (error) {
  367. console.log(error)
  368. } finally {
  369. this.loading = false
  370. }
  371. },
  372. }
  373. }
  374. </script>
  375. <style lang="scss" scoped>
  376. .select-cls {
  377. /deep/ &.el-select .el-input.is-focus .el-input__inner,
  378. /deep/ &.el-select .el-input__inner:focus,
  379. /deep/ &.el-cascader .el-input.is-focus .el-input__inner,
  380. /deep/ &.el-cascader .el-input__inner:focus {
  381. border-color: #DCDFE6;
  382. }
  383. /deep/ .el-input__suffix {
  384. border-top-right-radius: 4px;
  385. border-bottom-right-radius: 4px;
  386. border: 1px solid #DCDFE6;
  387. right: 0;
  388. width: 30px;
  389. background-color: #F1F1F1;
  390. .el-input__icon {
  391. color: #909399;
  392. }
  393. }
  394. &.cascader {
  395. /deep/ .el-input__suffix {
  396. height: 32px;
  397. top: 2px;
  398. }
  399. }
  400. }
  401. .disabled {
  402. cursor: not-allowed;
  403. }
  404. .screenBox {
  405. background: #fff;
  406. padding: 5px 20px 26px;
  407. position: relative;
  408. .export-btn {
  409. position: absolute;
  410. top: 17px;
  411. right: 4px;
  412. }
  413. .reset {
  414. width: 80px;
  415. height: 30px;
  416. background: #00b38a;
  417. border-radius: 100px 3px 3px 3px;
  418. border: 1px solid #d2d2d2;
  419. color: #ffffff;
  420. font-size: 14px;
  421. line-height: 30px;
  422. text-align: center;
  423. letter-spacing: 2px;
  424. cursor: pointer;
  425. position: absolute;
  426. right: 0;
  427. bottom: 0;
  428. }
  429. }
  430. .dataInfoBox {
  431. display: flex;
  432. margin-top: 10px;
  433. // justify-content: space-between;
  434. flex-wrap: wrap;
  435. .dataInfoItem {
  436. background: #ffffff;
  437. border-radius: 8px;
  438. margin-right: 10px;
  439. margin-bottom: 10px;
  440. //padding: 15px 80px 19px 20px;
  441. min-width: 200px;
  442. //max-width: 240px;
  443. height: 85px;
  444. padding-left: 20px;
  445. display: flex;
  446. flex-direction: column;
  447. justify-content: center;
  448. align-items: start;
  449. .dataItemTitle {
  450. display: flex;
  451. align-items: center;
  452. color: #6f6f6f;
  453. font-size: 13px;
  454. line-height: 17px;
  455. font-weight: bold;
  456. .titleIcon {
  457. height: 16px;
  458. margin-right: 4px;
  459. }
  460. }
  461. .dataItem-data {
  462. color: #000000;
  463. font-size: 19px;
  464. line-height: 28px;
  465. font-weight: bold;
  466. margin-top: 2px;
  467. display: flex;
  468. align-items: center;
  469. width: 100%;
  470. height: 50px;
  471. }
  472. }
  473. }
  474. </style>