statistics.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <div class="order-wrapper">
  3. <!-- <breadcrumb :item-name="['订单管理', '订单列表']"></breadcrumb> -->
  4. <el-card>
  5. <div class="tj flex">
  6. <div class="tj-item">
  7. <div class="tit">手续费</div>
  8. <div class="val">{{tj.commission||0}}</div>
  9. </div>
  10. <div class="tj-item">
  11. <div class="tit">赔付金</div>
  12. <div class="val">{{tj.compensation|| 0}}</div>
  13. </div>
  14. <div class="tj-item">
  15. <div class="tit">订单数</div>
  16. <div class="val">{{tj.order|| 0}}</div>
  17. </div>
  18. <div class="tj-item">
  19. <div class="tit">异常订单</div>
  20. <div class="val">{{tj.order_error||0}}</div>
  21. </div>
  22. <div class="tj-item">
  23. <div class="tit">token数</div>
  24. <div class="val">{{tj.tokon||0}}</div>
  25. </div>
  26. <div class="tj-item">
  27. <div class="tit">转账金额</div>
  28. <div class="val">{{tj.transfer|| 0}}</div>
  29. </div>
  30. <div class="tj-item">
  31. <div class="tit">提现到账</div>
  32. <div class="val">{{tj.withdraw||0}}</div>
  33. </div>
  34. <div class="tj-item">
  35. <div class="tit">提现审核中</div>
  36. <div class="val">{{tj.withdraw_0 || 0}}</div>
  37. </div>
  38. </div>
  39. </el-card>
  40. </div>
  41. </template>
  42. <script>
  43. import {
  44. mapState,
  45. mapMutations
  46. } from 'vuex';
  47. import {
  48. createCode,
  49. getUserList,
  50. getIndex,
  51. } from '@/request/agent.js'
  52. import {
  53. getRechangeList,
  54. rechange,
  55. getTokenList,
  56. createOrder,
  57. getUserInfo,
  58. payAuto,
  59. dataCount
  60. } from '@/request/user.js'
  61. import {
  62. showTime,
  63. sj
  64. } from '@/assets/js/tools.js'
  65. import {
  66. imgs
  67. } from '@/assets/js/admun.js'
  68. import {
  69. set
  70. } from 'core-js/library/core/dict';
  71. export default {
  72. components: {
  73. // SlideVerify
  74. },
  75. name: 'Order',
  76. data() {
  77. return {
  78. showStop:false,
  79. dialogVisible: false,
  80. xdForm: {
  81. phone: '',
  82. address: '',
  83. minPrice: '',
  84. maxPrice: ''
  85. },
  86. imgs: imgs,
  87. msg: '888',
  88. loading: false,
  89. formLabelWidth: '100px',
  90. form: {
  91. recharge_num: '',
  92. image: ''
  93. },
  94. dialogTableVisible: false,
  95. xiadanDia: false, //下单弹窗
  96. queryInfo: {
  97. keyword: '',
  98. page: 1,
  99. limit: 10
  100. },
  101. list: [],
  102. total: 0,
  103. dataloading: false,
  104. headers: {},
  105. tokenList: [],
  106. token: {},
  107. ybToken: {},
  108. minPriceList: [],
  109. maxPriceList: [],
  110. tipList: [],
  111. auto_order: false,//是否启动自动下单
  112. tj: {}
  113. }
  114. },
  115. computed: {
  116. ...mapState(['baseInfo', 'userInfo'])
  117. },
  118. created() {
  119. // this.getUserInfo()
  120. // this.getIndex()
  121. // this.getList()
  122. // this.getTokenList()
  123. this.dataCount()
  124. this.headers['token'] = window.sessionStorage.getItem('token')
  125. // console.log(this.imgs, 'imgs');
  126. },
  127. methods: {
  128. ...mapMutations(['setBaseInfo', 'setUserInfo','jUserMoney']),
  129. dataCount() {
  130. dataCount().then(res => {
  131. console.log(res);
  132. this.tj = res.data
  133. })
  134. },
  135. stopAuto() {
  136. this.auto_order = false
  137. this.showStop =false
  138. },
  139. getUserInfo() {
  140. getUserInfo().then(res => {
  141. this.setUserInfo(res.data)
  142. })
  143. },
  144. pd(arr, i = 0) {
  145. let that = this
  146. let len = arr.length - 1
  147. if (i <= len) {
  148. if (i == 0) {
  149. that.tipList.unshift(arr[i])
  150. that.pd(arr, ++i)
  151. } else {
  152. setTimeout(() => {
  153. that.tipList.unshift(arr[i])
  154. if(arr[i].title.indexOf('支付金额:') != -1) {
  155. // let price = zfInfo.title.replace(/支付金额:/,'')*1
  156. that.jUserMoney(-1*arr[i].title.replace(/支付金额:/,''))
  157. }
  158. that.pd(arr, ++i)
  159. }, arr[i - 1].time * 1000)
  160. }
  161. }else {
  162. that.xdForm.phone = ''
  163. that.xdForm.address = ''
  164. that.loading = false
  165. if(that.auto_order) {
  166. that.chooseNext()
  167. }else {
  168. that.xdForm.minPrice = ''
  169. that.xdForm.maxPrice = ''
  170. }
  171. }
  172. },
  173. ktAuto() {
  174. let that = this
  175. if (that.userInfo.money * 1 < that.baseInfo.auto_order * 1) {
  176. return that.$msg.error('您当前余额不足')
  177. }
  178. payAuto().then(res => {
  179. that.getUserInfo()
  180. that.dialogVisible = false
  181. that.auto_order = true
  182. that.chooseNext()
  183. //自动下单启动
  184. })
  185. },
  186. openZd() {
  187. let that = this
  188. if(that.loading) {
  189. return that.$msg.error('当前处于下单状态,请等待下单完成')
  190. }
  191. if (that.userInfo.auto_order == 0) {
  192. that.dialogVisible = true
  193. } else {
  194. //自动下单启动
  195. if(that.xdForm.minPrice == '') {
  196. return that.$msg.error('请选择最低价格')
  197. }
  198. if(that.xdForm.maxPrice == '') {
  199. return that.$msg.error('请选择最高价格')
  200. }
  201. that.auto_order = true
  202. that.chooseNext()
  203. }
  204. },
  205. //选择下一个可用token
  206. chooseNext() {
  207. let that = this
  208. that.token = that.tokenList.find(item => item.bl == false )
  209. if(that.auto_order) {
  210. if(that.token) {
  211. if(that.xdForm.minPrice == '') {
  212. return that.$msg.error('请选择最低价格')
  213. }
  214. if(that.xdForm.maxPrice == '') {
  215. return that.$msg.error('请选择最高价格')
  216. }
  217. that.sjAddress()
  218. that.sjPhone()
  219. // that.$msg.success('开启自动下单,请勿进行操作')
  220. // 启动
  221. that.createOrder()
  222. }else {
  223. //停止
  224. that.auto_order = false
  225. }
  226. }
  227. },
  228. createOrder() {
  229. let that = this
  230. if(that.loading ) {
  231. return
  232. }
  233. if ( that.token.bl) {
  234. if(that.auto_order) {
  235. }else {
  236. return this.$msg.error('该TOKEN,当天使用次数已满!')
  237. }
  238. }
  239. if(that.xdForm.minPrice == '') {
  240. return that.$msg.error('请选择最低价格')
  241. }
  242. if(that.xdForm.maxPrice == '') {
  243. return that.$msg.error('请选择最高价格')
  244. }
  245. if(that.xdForm.minPrice*1 > that.xdForm.maxPrice*1) {
  246. return that.$msg.error('最高价格需大于最低价格')
  247. }
  248. if(that.xdForm.phone == '') {
  249. return that.$msg.error('请输入手机号码')
  250. }
  251. if (!/(^1[2|3|4|5|6|7|8|9][0-9]{9}$)/.test(that.xdForm.phone)) {
  252. return that.$msg.error('请输入正确的手机号码')
  253. }
  254. if(that.xdForm.address == '') {
  255. return that.$msg.error('请输入收货地址')
  256. }
  257. that.loading = true
  258. createOrder({
  259. min_price: that.xdForm.minPrice,
  260. max_price: that.xdForm.maxPrice,
  261. address: that.xdForm.address,
  262. phone: that.xdForm.phone,
  263. token: that.token.token
  264. }).then(res => {
  265. //更新token
  266. that.token.count++
  267. if(that.token.count == 2) {
  268. that.token.bl = true
  269. }
  270. // 加载tip
  271. that.pd(res.data, 0)
  272. }).catch(err => {
  273. console.log(err);
  274. that.loading = false
  275. })
  276. },
  277. getIndex() {
  278. getIndex().then(res => {
  279. this.setBaseInfo(res.data)
  280. let arr = [],
  281. arr2 = []
  282. res.data.price_min.forEach(item => {
  283. let a = {
  284. value: item * 1,
  285. label: item
  286. }
  287. arr.push(a)
  288. })
  289. res.data.price_max.forEach(item => {
  290. let a = {
  291. value: item * 1,
  292. label: item
  293. }
  294. arr2.push(a)
  295. })
  296. this.minPriceList = arr
  297. this.maxPriceList = arr2
  298. })
  299. },
  300. showTime,
  301. sjPhone() {
  302. if(this.loading) {
  303. return
  304. }
  305. this.xdForm.phone = sj(this.baseInfo.sys_phone)
  306. },
  307. sjAddress() {
  308. if(this.loading) {
  309. return
  310. }
  311. this.xdForm.address = sj(this.baseInfo.system_address)
  312. },
  313. closeXd() {
  314. this.xiadanDia = false
  315. this.xdForm.phone = ''
  316. this.xdForm.address = ''
  317. },
  318. onSuccess() {
  319. console.log('success');
  320. this.token = this.ybToken
  321. this.xdForm.minPrice = ''
  322. this.xdForm.maxPrice = ''
  323. this.dialogTableVisible = false
  324. },
  325. onFail() {
  326. console.log('fail');
  327. },
  328. onRefresh() {
  329. console.log('refresh');
  330. },
  331. getTokenList() {
  332. getTokenList().then(res => {
  333. this.tokenList = res.data.map(item => {
  334. item.count = item.count*1
  335. return item
  336. })
  337. // 获取第一次选择的token
  338. this.chooseNext()
  339. console.log(this.token, 'this.token');
  340. })
  341. },
  342. chooseToken(item) {
  343. // console.log(item,'ddddd');
  344. if(this.loading) {
  345. return
  346. }
  347. if (item.bl) {
  348. return this.$msg.error('该TOKEN,当天使用次数已满!')
  349. }
  350. this.ybToken = item
  351. this.dialogTableVisible = true
  352. },
  353. handleAvatarSuccess(res, file) {
  354. this.form.image = res.data.fullurl;
  355. },
  356. beforeAvatarUpload(file) {
  357. // const isJPG = file.type === 'image/jpeg/png';
  358. // const isLt2M = file.size / 1024 / 1024 < 2;
  359. // if (!isJPG) {
  360. // this.$message.error('上传头像图片只能是 JPG 格式!');
  361. // }
  362. // if (!isLt2M) {
  363. // this.$message.error('上传头像图片大小不能超过 2MB!');
  364. // }
  365. // return isJPG && isLt2M;
  366. return true
  367. },
  368. handleAvatarError() {
  369. },
  370. getList(type) {
  371. let that = this
  372. if (type == 'reload') {
  373. that.queryInfo.page = 1
  374. that.dataloading = false
  375. }
  376. if (that.dataloading) {
  377. return
  378. }
  379. that.dataloading = true
  380. getRechangeList(that.queryInfo).then(res => {
  381. that.total = res.data.count
  382. that.list = res.data.data
  383. that.dataloading = false
  384. }).catch(err => {
  385. that.dataloading = false
  386. })
  387. },
  388. handleSizeChange(newPageSize) {
  389. this.queryInfo.limit = newPageSize
  390. this.getList()
  391. },
  392. handleCurrentChange(newPageNum) {
  393. this.queryInfo.page = newPageNum
  394. this.getList()
  395. },
  396. },
  397. }
  398. </script>
  399. <style lang="scss" scoped>
  400. .tj {
  401. width: 500px;
  402. flex-wrap: wrap;
  403. .tj-item {
  404. width: 120px;
  405. height: 120px;
  406. border-radius: 20px;
  407. box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.4);
  408. display: flex;
  409. flex-direction: column;
  410. justify-content: center;
  411. align-items: center;
  412. margin: 20px;
  413. .val {
  414. margin-top: 20px;
  415. color: rgb(15, 131, 254);
  416. }
  417. }
  418. }
  419. </style>