userCenterMyOrderCom.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872
  1. <template>
  2. <div class="userCenterMyOrderCom">
  3. <div class="title">
  4. {{ $t('common.myOrder') }}
  5. <span style="margin: 0 10px">{{
  6. $i18n.locale == 'zh' ? '共计' : 'All'
  7. }}</span>
  8. <span>{{ this.page.total }}</span>
  9. <span
  10. style="color: red; margin-left: 20px; font-weight: 700; font-size: 14px"
  11. >{{
  12. $i18n.locale == 'zh'
  13. ? '下单成功的商品,超过5分钟未支付,系统默认关闭此次交易'
  14. : 'Please complete the payment within 5 minutes for the goods successfully ordered'
  15. }}</span
  16. >
  17. </div>
  18. <div class="table">
  19. <div class="search">
  20. <span
  21. :class="{ active: params.search1 === '全部' }"
  22. @click="activeChange('全部')"
  23. >{{ $i18n.locale == 'zh' ? '全部' : 'All' }}</span
  24. >
  25. <span
  26. :class="{ active: params.search1 === '待付款' }"
  27. @click="activeChange('待付款')"
  28. >{{ $i18n.locale == 'zh' ? '待付款' : 'To be Paid' }}</span
  29. >
  30. <span
  31. :class="{ active: params.search1 === '待发货' }"
  32. @click="activeChange('待发货')"
  33. >{{ $i18n.locale == 'zh' ? '待发货' : 'Wait Deliver' }}</span
  34. >
  35. <span
  36. :class="{ active: params.search1 === '待收货' }"
  37. @click="activeChange('待收货')"
  38. >{{ $i18n.locale == 'zh' ? '待收货' : 'To Be Received' }}</span
  39. >
  40. <span
  41. :class="{ active: params.search1 === '待评论' }"
  42. @click="activeChange('待评论')"
  43. >{{ $i18n.locale == 'zh' ? '待评论' : 'To Be Commented' }}</span
  44. >
  45. <span
  46. :class="{ active: params.search1 === '已完成' }"
  47. @click="activeChange('已完成')"
  48. >{{ $i18n.locale == 'zh' ? '已完成' : 'Completed' }}</span
  49. >
  50. <span
  51. :class="{ active: params.search1 === '已取消' }"
  52. @click="activeChange('已取消')"
  53. >{{ $i18n.locale == 'zh' ? '已取消' : 'Cancelled' }}</span
  54. >
  55. <span
  56. :class="{ active: params.search1 === '已关闭' }"
  57. @click="activeChange('已关闭')"
  58. >{{ $i18n.locale == 'zh' ? '已关闭' : 'Colsed' }}</span
  59. >
  60. </div>
  61. <div v-if="showContent">
  62. <el-table
  63. stripe
  64. :data="
  65. orderList.filter(
  66. (data) =>
  67. !search ||
  68. data.commodityName.toLowerCase().includes(search.toLowerCase())
  69. )
  70. "
  71. v-loading="loading"
  72. style="width: 100%"
  73. height="488"
  74. :header-cell-style="{ backgroundColor: '#f8f8f8' }"
  75. >
  76. <el-table-column
  77. prop="orderNo"
  78. align="center"
  79. :label="$i18n.locale === 'zh' ? '订单编号' : 'OrderID'"
  80. width="280"
  81. >
  82. </el-table-column>
  83. <el-table-column
  84. :prop="$i18n.locale === 'zh' ? 'commodityName' : 'commodityNameEn'"
  85. align="center"
  86. :label="$i18n.locale === 'zh' ? '商品名称' : 'Trade Name'"
  87. width="120"
  88. >
  89. </el-table-column>
  90. <el-table-column
  91. prop="exchangeQuantity"
  92. align="center"
  93. :label="$i18n.locale === 'zh' ? '兑换数量' : 'Quantity'"
  94. width="100"
  95. >
  96. </el-table-column>
  97. <el-table-column
  98. prop="point"
  99. align="center"
  100. :label="
  101. $i18n.locale === 'zh' ? '兑换要求' : 'Exchange requirements'
  102. "
  103. width="100"
  104. >
  105. <template slot-scope="scope">
  106. <span>
  107. {{ scope.row.point
  108. }}{{ $i18n.locale === 'zh' ? '积分' : 'Integral' }}
  109. </span>
  110. <span v-if="scope.row.price !== 0"
  111. >+{{ scope.row.price
  112. }}{{ $i18n.locale === 'zh' ? '元' : 'RMB' }}</span
  113. >
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. align="center"
  118. :label="$i18n.locale === 'zh' ? '创建时间' : 'Creation Time'"
  119. width="200"
  120. >
  121. <template slot-scope="scope">
  122. <div>
  123. {{ scope.row.createDate | time('YYYY-MM-DD HH:mm:ss') }}
  124. </div>
  125. </template>
  126. </el-table-column>
  127. <el-table-column
  128. align="center"
  129. :label="$i18n.locale === 'zh' ? '操作' : 'Operate'"
  130. width="180"
  131. >
  132. <template slot="header" slot-scope="scope">
  133. <el-input
  134. v-model="search"
  135. size="mini"
  136. :placeholder="
  137. $i18n.locale === 'zh' ? '请输入商品名称' : 'Enter The Name'
  138. "
  139. clearable
  140. />
  141. </template>
  142. <template slot-scope="scope">
  143. <el-button
  144. v-if="scope.row.orderStatus === '0'"
  145. type="text"
  146. size="mini"
  147. style="display: block"
  148. @click="getDellor(scope.row)"
  149. >
  150. {{ $i18n.locale === 'zh' ? '退款' : 'Refund' }}
  151. </el-button>
  152. <el-button
  153. v-if="scope.row.orderStatus === '5'"
  154. type="text"
  155. size="mini"
  156. style="display: block"
  157. @click="cancelOrderStatus(scope.row)"
  158. >
  159. {{ $i18n.locale === 'zh' ? '取消订单' : 'Order Cancel' }}
  160. </el-button>
  161. <el-button
  162. v-if="scope.row.orderStatus === '5'"
  163. type="text"
  164. size="mini"
  165. style="display: block"
  166. >
  167. <span
  168. v-if="scope.row.price == 0"
  169. @click="payIntetral(scope.row)"
  170. >{{
  171. $i18n.locale === 'zh' ? '积分支付' : 'Point payment'
  172. }}</span
  173. >
  174. <span v-else @click="payMoney(scope.row)">{{
  175. $i18n.locale === 'zh' ? '去付款' : 'Pay'
  176. }}</span>
  177. </el-button>
  178. <el-button
  179. type="text"
  180. size="mini"
  181. style="display: block"
  182. @click="edit('订单详情', scope.row)"
  183. >
  184. {{ $i18n.locale === 'zh' ? '订单详情' : 'Order Detail' }}
  185. </el-button>
  186. <el-button
  187. v-if="scope.row.orderStatus === '2'"
  188. type="text"
  189. size="mini"
  190. style="display: block"
  191. @click="edit('评价', scope.row)"
  192. >
  193. {{ $i18n.locale === 'zh' ? '评价' : 'Evaluate' }}
  194. </el-button>
  195. <el-button
  196. v-if="
  197. ['2', '4'].includes(scope.row.orderStatus) &&
  198. scope.row.adaptType === '1'
  199. "
  200. type="text"
  201. size="mini"
  202. style="display: block"
  203. @click="download(scope.row)"
  204. >
  205. {{ $i18n.locale === 'zh' ? '下载' : ' Download' }}
  206. </el-button>
  207. <el-button
  208. v-if="scope.row.orderStatus === '1'"
  209. type="text"
  210. size="mini"
  211. style="display: block"
  212. @click="edit('确认收货', scope.row)"
  213. >
  214. {{ $i18n.locale === 'zh' ? '确认收货' : 'Confirm Receipt' }}
  215. </el-button>
  216. <el-button
  217. v-if="
  218. scope.row.orderStatus === '3' || scope.row.orderStatus === '4'
  219. "
  220. type="text"
  221. size="mini"
  222. style="display: block"
  223. @click="deleteOrders(scope.row)"
  224. >
  225. {{ $i18n.locale === 'zh' ? '删除' : ' Delete' }}
  226. </el-button>
  227. <el-button
  228. v-if="scope.row.orderStatus === '6'"
  229. type="text"
  230. size="mini"
  231. style="display: block"
  232. @click="deleteOrders(scope.row)"
  233. >
  234. {{ $i18n.locale === 'zh' ? '删除' : ' Delete' }}
  235. </el-button>
  236. </template>
  237. </el-table-column>
  238. </el-table>
  239. <el-pagination
  240. background
  241. @size-change="
  242. (val) => {
  243. page.pageSize = val
  244. }
  245. "
  246. @current-change="
  247. (val) => {
  248. page.pageNo = val
  249. }
  250. "
  251. layout="prev, pager, next"
  252. :total="page.total"
  253. :current-page="page.pageNo"
  254. :page-sizes="[10, 20, 50, 100]"
  255. :page-size="page.pageSize"
  256. style="text-align: center; margin-top: 20px"
  257. >
  258. </el-pagination>
  259. </div>
  260. <div v-else style="margin-left: -50px; margin-top: 100px">
  261. <el-empty
  262. :description="$i18n.locale === 'zh' ? '暂无数据' : 'No Data'"
  263. ></el-empty>
  264. </div>
  265. </div>
  266. <!-- 消息提示 -->
  267. <el-dialog
  268. :title="
  269. $i18n.locale === 'zh' ? '请确认操作' : 'Please confirm the operation'
  270. "
  271. :visible.sync="dialogVisibleStatusUser"
  272. width="20%"
  273. >
  274. <span>{{ UserTitleText }}</span>
  275. <span slot="footer" class="dialog-footer">
  276. <el-button @click="dialogVisibleStatusUser = false">{{
  277. $i18n.locale === 'zh' ? '取消' : 'Cancel'
  278. }}</el-button>
  279. <el-button type="primary" @click="getUserText">{{
  280. $i18n.locale === 'zh' ? '确定' : 'Sure'
  281. }}</el-button>
  282. </span>
  283. </el-dialog>
  284. <!-- 选择付款方式 -->
  285. <el-dialog
  286. :title="
  287. $i18n.locale === 'zh'
  288. ? '请选择付款方式'
  289. : 'Please select a payment method'
  290. "
  291. :visible.sync="dialogVisibleStatus"
  292. width="35%"
  293. >
  294. <div style="width: 100%; display: flex; justify-content: space-evenly">
  295. <span
  296. style="
  297. display: inline-block;
  298. width: 181px;
  299. height: 181px;
  300. overflow: hidden;
  301. line-height: 181px;
  302. cursor: pointer;
  303. "
  304. @click="getPayDellor('1')"
  305. ><img src="@/assets/userpay3.png" alt="" style="width: 100%"
  306. /></span>
  307. <!-- <span
  308. style="
  309. display: inline-block;
  310. width: 181px;
  311. height: 181px;
  312. line-height: 181px;
  313. cursor: pointer;
  314. "
  315. @click="getPayDellor('2')"
  316. ><img src="@/assets/userpay.png" alt="" style="width: 100%"
  317. /></span> -->
  318. <!-- <span
  319. style="
  320. display: inline-block;
  321. width: 181px;
  322. height: 181px;
  323. line-height: 181px;
  324. cursor: pointer;
  325. "
  326. @click="getPayDellor('3')"
  327. ><img
  328. src="@/assets/userpay2.png"
  329. alt=""
  330. style="width: 100%; line-height: 181px"
  331. /></span> -->
  332. </div>
  333. </el-dialog>
  334. <!-- 订单确认 -->
  335. <el-dialog
  336. :title="$i18n.locale === 'zh' ? '订单确认' : 'Order Confirmation'"
  337. :visible.sync="dialogVisible"
  338. width="20%"
  339. :before-close="dialogBeforeClose"
  340. >
  341. <div>
  342. {{ $i18n.locale === 'zh' ? '是否确认收货' : 'Confirm Receipt' }}
  343. </div>
  344. <div slot="footer">
  345. <el-button @click="dialogVisible = false">{{
  346. $i18n.locale === 'zh' ? '取 消' : 'Cancel'
  347. }}</el-button>
  348. <el-button type="primary" @click="orderconfirm">{{
  349. $i18n.locale === 'zh' ? '确 定' : 'Determine'
  350. }}</el-button>
  351. </div>
  352. </el-dialog>
  353. </div>
  354. </template>
  355. <script>
  356. import moment from 'moment'
  357. import {
  358. cancelGoodsOrders,
  359. toObtainListOrder,
  360. orderConfirmation,
  361. deleteOrders,
  362. getMoney,
  363. getMoneyStatus,
  364. } from '@/api/user'
  365. import { gatResearchResultView } from '@/api/research/baseResearchResultView'
  366. import { getToken } from '@/api/token'
  367. export default {
  368. name: 'userCenterMyOrderCom',
  369. data() {
  370. return {
  371. valueStatus: {},
  372. booleanFlag: {},
  373. user: {
  374. umsUser: {},
  375. },
  376. loading: true,
  377. params: {
  378. search1: '全部',
  379. search2: '',
  380. },
  381. page: {
  382. pageNo: 1,
  383. pageSize: 10,
  384. total: 0,
  385. },
  386. orderList: [],
  387. search: '',
  388. dialogVisible: false,
  389. dialogVisibleStatus: false,
  390. dialogVisibleStatusUser: false,
  391. userTimeNum: 0,
  392. userInfoDtua: '',
  393. userTypeStua: '',
  394. UserTitleText: '',
  395. orderconfirmId: '',
  396. evaluationId: {},
  397. showContent: false,
  398. }
  399. },
  400. filters: {
  401. twoDecimal(value) {
  402. return parseFloat(String(value)).toFixed(2)
  403. },
  404. time(date, type) {
  405. return moment(date).format(type)
  406. },
  407. },
  408. watch: {
  409. page: {
  410. handler: function () {
  411. this.loading = true
  412. this.getUserOrderPage()
  413. this.toObtainListOrder()
  414. },
  415. deep: true,
  416. },
  417. params: {
  418. handler: function () {
  419. this.loading = true
  420. this.toObtainListOrder()
  421. },
  422. deep: true,
  423. },
  424. },
  425. mounted() {
  426. this.init()
  427. },
  428. methods: {
  429. deleteOrders(val) {
  430. this.dialogVisibleStatusUser = true
  431. this.userInfoDtua = val
  432. this.userTypeStua = '3'
  433. if (this.$i18n.locale === 'zh') {
  434. this.UserTitleText = '确定删除次订单吗?'
  435. } else {
  436. this.UserTitleText = 'Are you sure to delete this order?'
  437. }
  438. },
  439. //删除订单
  440. deleteUserOrder() {
  441. let val = this.userInfoDtua
  442. getToken().then((res) => {
  443. deleteOrders(val.id, res.data)
  444. .then((res) => {
  445. if (res.status === '200')
  446. this.$message({
  447. message:
  448. this.$i18n.locale == 'zh'
  449. ? '删除订单成功'
  450. : 'Order deleted successfully',
  451. type: 'success',
  452. })
  453. console.log(res)
  454. this.init()
  455. })
  456. .catch((error) => {
  457. console.log(error)
  458. this.$message({
  459. message:
  460. this.$i18n.locale == 'zh'
  461. ? '删除订单失败'
  462. : 'Order deleted error',
  463. type: 'error',
  464. })
  465. })
  466. })
  467. },
  468. download(val) {
  469. let data = {
  470. reserveFour: val.commodityId,
  471. language: this.$i18n.locale.toUpperCase(),
  472. }
  473. gatResearchResultView(data).then((res) => {
  474. let url = ''
  475. let name = ''
  476. if (res.data.baseResearchResultView) {
  477. url = res.data.baseResearchResultView.researchResultFile
  478. name = res.data.baseResearchResultView.name
  479. }
  480. const link = document.createElement('a')
  481. link.href = 'api/file/pub/' + url
  482. link.download = name //下载的文件名
  483. link.click()
  484. })
  485. },
  486. init() {
  487. this.user = JSON.parse(window.localStorage.getItem('user'))
  488. if (this.user.umsUser.userPic == undefined) {
  489. this.user.umsUser.userPic = ''
  490. }
  491. this.getUserOrderPage()
  492. this.toObtainListOrder()
  493. },
  494. getUserOrderPage() {
  495. setTimeout(() => {
  496. this.loading = false
  497. }, 500)
  498. },
  499. activeChange(value) {
  500. this.params.search1 = value
  501. this.page.pageNo = 1
  502. this.getUserOrderPage()
  503. },
  504. topUp() {
  505. alert('topUp()')
  506. },
  507. edit(type, data) {
  508. console.log(data)
  509. switch (type) {
  510. case '付款':
  511. break
  512. case '评价':
  513. console.log('评价')
  514. this.$router.push({
  515. path: '/userCenterMyOrderEvaluate',
  516. query: { key: data },
  517. })
  518. // this.dialogVisible = true;
  519. this.orderconfirmId = data.id
  520. this.evaluation = data
  521. break
  522. case '确认收货':
  523. this.dialogVisible = true
  524. this.orderconfirmId = data.id
  525. this.evaluation = data
  526. break
  527. case '取消订单':
  528. break
  529. case '删除订单':
  530. break
  531. case '订单详情':
  532. window.localStorage.setItem('orderDetail', JSON.stringify(data))
  533. this.$router.push({
  534. path: '/userCenterMyOrderDetails',
  535. // query: { key: data },
  536. })
  537. break
  538. }
  539. },
  540. // 获取订单列表
  541. toObtainListOrder() {
  542. let param = {
  543. pageSize: this.page.pageSize,
  544. pageNo: this.page.pageNo,
  545. userId: this.user.userId,
  546. }
  547. if (this.params.search1 == '待发货') {
  548. param.orderStatus = 0
  549. }
  550. if (this.params.search1 == '待收货') {
  551. param.orderStatus = 1
  552. }
  553. if (this.params.search1 == '待评论') {
  554. param.orderStatus = 2
  555. }
  556. if (this.params.search1 == '已取消') {
  557. param.orderStatus = 3
  558. }
  559. if (this.params.search1 == '已完成') {
  560. param.orderStatus = 4
  561. }
  562. if (this.params.search1 == '待付款') {
  563. param.orderStatus = 5
  564. }
  565. if (this.params.search1 == '已关闭') {
  566. param.orderStatus = 6
  567. }
  568. toObtainListOrder(param)
  569. .then((res) => {
  570. var data = res.data
  571. if (JSON.stringify(data) !== '{}') {
  572. this.showContent = true
  573. this.orderList = res.data.umsPointCommodityOrders
  574. this.page.total = Number(res.data.page.totalCount)
  575. } else {
  576. this.showContent = false
  577. this.page.total = 0
  578. }
  579. })
  580. .then(() => {
  581. this.loading = false
  582. })
  583. .catch(() => {
  584. this.loading = false
  585. })
  586. },
  587. // 订单确认
  588. orderconfirm() {
  589. this.dialogVisible = false
  590. getToken().then((res) => {
  591. orderConfirmation(this.orderconfirmId, res.data).then((res) => {
  592. if (res.status == '200') {
  593. this.$message({
  594. message:
  595. this.$i18n.locale == 'zh'
  596. ? '确认收货成功'
  597. : 'Confirm Receipt Succeeded',
  598. type: 'success',
  599. })
  600. this.init()
  601. }
  602. })
  603. })
  604. },
  605. //支付状态调用
  606. getUserInStau() {
  607. getMoneyStatus(this.valueStatus.orderNo)
  608. .then((res) => {
  609. if (res.data.payStatus == '1') {
  610. this.$router.go(0)
  611. } else {
  612. if (this.userTimeNum < 36) {
  613. setTimeout(() => {
  614. this.getUserInStau()
  615. this.userTimeNum += 1
  616. // console.log(this.userTimeNum)
  617. }, 5000)
  618. } else {
  619. this.$router.go(0)
  620. }
  621. }
  622. })
  623. .catch((error) => {
  624. console.log(error.msg)
  625. })
  626. },
  627. //支付调用
  628. getPayDellor(num) {
  629. this.getUserInStau()
  630. if (this.valueStatus.price == 0) {
  631. } else {
  632. if (num == 1) {
  633. let orderId = this.valueStatus.orderNo
  634. let payType = 'alipay'
  635. getToken().then((res) => {
  636. getMoney(orderId, payType, res.data)
  637. .then((res) => {
  638. if (res.status == 200) {
  639. let paramsUser = res.data.htmlPath
  640. window.open(paramsUser, '_blank')
  641. } else {
  642. this.$message.error(res.msg)
  643. }
  644. })
  645. .catch((error) => {
  646. this.$message.error(error.msg)
  647. })
  648. })
  649. } else if (num == 2) {
  650. let orderId = this.valueStatus.orderNo
  651. let payType = 'wechatpay'
  652. getToken().then((res) => {
  653. getMoney(orderId, payType, res.data)
  654. .then((res) => {
  655. if (res.status == 200) {
  656. let paramsUser = res.data.htmlPath
  657. window.open(paramsUser, '_blank')
  658. } else {
  659. this.$message.error(res.msg)
  660. }
  661. })
  662. .catch((error) => {
  663. this.$message.error(error.msg)
  664. })
  665. })
  666. } else if (num == 3) {
  667. let orderId = this.valueStatus.orderNo
  668. let payType = 'unionpay'
  669. getToken().then((res) => {
  670. getMoney(orderId, payType, res.data)
  671. .then((res) => {
  672. if (res.status == 200) {
  673. let paramsUser = res.data.htmlPath
  674. window.open(paramsUser, '_blank')
  675. } else {
  676. this.$message.error(res.msg)
  677. }
  678. })
  679. .catch((error) => {
  680. this.$message.error(error.msg)
  681. })
  682. })
  683. } else {
  684. let orderId = this.valueStatus.orderNo
  685. let payType = 'otherpay'
  686. getToken().then((res) => {
  687. getMoney(orderId, payType, res.data)
  688. .then((res) => {
  689. if (res.status == 200) {
  690. let paramsUser = res.data.htmlPath
  691. window.open(paramsUser, '_blank')
  692. } else {
  693. this.$message.error(res.msg)
  694. }
  695. })
  696. .catch((error) => {
  697. this.$message.error(error.msg)
  698. })
  699. })
  700. }
  701. }
  702. this.dialogVisibleStatus = false
  703. },
  704. //积分支付
  705. payIntetral(value) {
  706. this.dialogVisibleStatusUser = true
  707. this.valueStatus = value
  708. this.userTypeStua = '4'
  709. if (this.$i18n.locale === 'zh') {
  710. this.UserTitleText = '确定支付吗?'
  711. } else {
  712. this.UserTitleText = 'Are you sure to pay?'
  713. }
  714. },
  715. getIntetralUser() {
  716. let orderId = this.valueStatus.orderNo
  717. let payType = 'pointpay'
  718. getToken().then((res) => {
  719. getMoney(orderId, payType, res.data)
  720. .then((res) => {
  721. if (res.status == '200') {
  722. if (this.$i18n.locale === 'zh') {
  723. this.$message.success('支付成功')
  724. } else {
  725. this.$message.success('Payment succeeded')
  726. }
  727. this.init()
  728. }
  729. })
  730. .catch((error) => {
  731. this.$message.error(error.msg)
  732. })
  733. })
  734. },
  735. //付款
  736. payMoney(value) {
  737. this.dialogVisibleStatus = true
  738. this.valueStatus = value
  739. },
  740. //退款
  741. getDellor(value) {
  742. this.dialogVisibleStatusUser = true
  743. if (this.$i18n.locale === 'zh') {
  744. this.UserTitleText = '确定发起退款吗?'
  745. } else {
  746. this.UserTitleText = 'Are you sure to initiate refund?'
  747. }
  748. this.userTypeStua = '1'
  749. this.userInfoDtua = value
  750. },
  751. //退款操作
  752. getMoreMoney() {
  753. console.log('退不了,爱要不要')
  754. },
  755. //提示确定按钮
  756. getUserText() {
  757. this.dialogVisibleStatusUser = false
  758. if (this.userTypeStua == '2') {
  759. this.cancelOrder()
  760. }
  761. if (this.userTypeStua == '1') {
  762. this.getMoreMoney()
  763. }
  764. if (this.userTypeStua == '3') {
  765. this.deleteUserOrder()
  766. }
  767. if (this.userTypeStua == '4') {
  768. this.getIntetralUser()
  769. }
  770. },
  771. // 取消订单
  772. cancelOrderStatus(data) {
  773. this.dialogVisibleStatusUser = true
  774. if (this.$i18n.locale === 'zh') {
  775. this.UserTitleText = '确认取消订单?'
  776. } else {
  777. this.UserTitleText = 'Confirm Cancel Order?'
  778. }
  779. this.userTypeStua = '2'
  780. this.userInfoDtua = data
  781. },
  782. //取消订单操作
  783. cancelOrder() {
  784. let data = this.userInfoDtua
  785. getToken().then((res) => {
  786. cancelGoodsOrders(data.id, res.data)
  787. .then((res) => {
  788. if (res.status === '200')
  789. this.$message({
  790. message:
  791. this.$i18n.locale == 'zh'
  792. ? '取消订单成功'
  793. : 'Order cancelled successfully',
  794. type: 'success',
  795. })
  796. console.log(res)
  797. this.init()
  798. })
  799. .catch((error) => {
  800. console.log(error)
  801. this.$message({
  802. message:
  803. this.$i18n.locale == 'zh'
  804. ? '取消订单失败'
  805. : 'Order cancelled error',
  806. type: 'error',
  807. })
  808. })
  809. })
  810. },
  811. dialogBeforeClose() {
  812. this.dialogVisible = false
  813. },
  814. },
  815. }
  816. </script>
  817. <style scoped lang="less">
  818. /deep/.el-dialog {
  819. display: flex;
  820. flex-direction: column;
  821. margin: 0 !important;
  822. position: absolute;
  823. top: 50%;
  824. left: 50%;
  825. transform: translate(-50%, -50%);
  826. max-height: calc(100% - 30px);
  827. max-width: calc(100% - 30px);
  828. }
  829. .userCenterMyOrderCom {
  830. .title {
  831. height: 60px;
  832. line-height: 60px;
  833. padding-top: 30px;
  834. margin-left: 30px;
  835. margin-right: 30px;
  836. border-bottom: 1px solid rgba(228, 228, 228, 1);
  837. }
  838. .search {
  839. font-size: 14px;
  840. font-weight: 600;
  841. height: 70px;
  842. line-height: 70px;
  843. span {
  844. cursor: pointer;
  845. margin: 0 20px;
  846. &.active {
  847. color: #60aae3;
  848. }
  849. }
  850. }
  851. .table {
  852. padding-bottom: 30px;
  853. /deep/ .el-button {
  854. margin: 0 auto;
  855. }
  856. /deep/ .el-button + .el-button {
  857. margin: 5px auto 0;
  858. }
  859. }
  860. }
  861. </style>