exchange_record.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <view :style="viewColor">
  3. <view v-if="exchangeList.length>0">
  4. <view class="exchange-record">
  5. <view v-for="(item,index) in exchangeList" :key="index">
  6. <view class="item" v-for="(itm, idx) in item.orderProduct" :key="idx">
  7. <view class="exchange_record-time">
  8. <view>
  9. {{item.paid == 1 ? '兑换时间:'+item.pay_time : '订单编号:'+item.order_sn}}
  10. </view>
  11. <view v-if="item.paid == 0" class="status">
  12. 待付款
  13. </view>
  14. <view v-else class="status">
  15. {{item.status == 0 ? '待发货' : item.status == 1 ? '待收货' : '已完成'}}
  16. </view>
  17. </view>
  18. <view v-if="itm.cart_info" class="picTxt acea-row row-between-wrapper">
  19. <view class="pictrue">
  20. <image :src="itm.cart_info.productAttr&&itm.cart_info.productAttr.image || itm.cart_info.product.image" />
  21. </view>
  22. <view class="text acea-row row-column-around">
  23. <view class="line1" style="width: 100%;">{{ itm.cart_info.product.store_name }}</view>
  24. <view class="line1 gray-sty">{{itm.cart_info.productAttr&&itm.cart_info.productAttr.sku || '默认'}}</view>
  25. </view>
  26. </view>
  27. <view class="bottom acea-row row-between-wrapper">
  28. <view class="end"></view>
  29. <view class="acea-row row-middle row-right">
  30. <view v-if="item.paid == 0" class='bnt bg-colort' @click='goPay(item)'>立即付款</view>
  31. <view class="bnt cancel" v-if="(item.status == 2 || item.status == 1) && item.delivery_type == 1"
  32. @click="getLogistics(item.order_id)">
  33. 查看物流
  34. </view>
  35. <view v-if="item.status == 3 && item.paid == 1" class="bnt cancel" @click="delOrder(item.order_id,index,idx)">删除</view>
  36. <view v-if="item.paid == 1" class="bnt bg-colort" @click="goDetail(item.order_id)">
  37. 查看详情
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view v-if="isLogin" :hidden="!loading" class="acea-row row-center-wrapper loadingicon">
  46. <text :hidden="!loading" class="iconfont icon-jiazai loading"></text>
  47. {{loadTitle}}
  48. </view>
  49. <block v-if="exchangeList.length == 0 && !loading">
  50. <emptyPage title="暂无兑换记录~"></emptyPage>
  51. </block>
  52. <payment :payMode='payMode' :order_type="2" :pay_close="pay_close" :returnUrl="'/pages/points_mall/integral_order_details?order_id='+order_id" @onChangeFun='onChangeFun' :order_id="pay_order_id" :totalPrice='totalPrice'></payment>
  53. </view>
  54. </template>
  55. <script>
  56. // +----------------------------------------------------------------------
  57. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  58. // +----------------------------------------------------------------------
  59. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  60. // +----------------------------------------------------------------------
  61. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  62. // +----------------------------------------------------------------------
  63. // | Author: CRMEB Team <admin@crmeb.com>
  64. // +----------------------------------------------------------------------
  65. import emptyPage from '@/components/emptyPage.vue';
  66. import { mapGetters } from 'vuex';
  67. import { integralOrderList, integralOrderDelete } from "@/api/points_mall.js";
  68. import { getUserInfo } from "@/api/user.js";
  69. import payment from '@/components/payment';
  70. import { configMap } from '@/utils';
  71. import { toLogin } from '@/libs/login.js';
  72. export default {
  73. name: "exchangeRecord",
  74. components: {
  75. emptyPage,
  76. payment,
  77. },
  78. props: {},
  79. data: function() {
  80. return {
  81. exchangeList: [],
  82. payMode: [{
  83. name: "微信支付",
  84. icon: "icon-weixinzhifu",
  85. value: 'wechat',
  86. title: '微信快捷支付',
  87. payStatus: 1
  88. },
  89. {
  90. name: "支付宝支付",
  91. icon: "icon-zhifubao",
  92. value: 'alipay',
  93. title: '支付宝支付',
  94. payStatus: this.$store.getters.globalData.alipay_open
  95. },
  96. {
  97. name: "余额支付",
  98. icon: "icon-yuezhifu",
  99. value: 'balance',
  100. title: '可用余额:',
  101. number: 0,
  102. payStatus: this.$store.getters.globalData.yue_pay_status
  103. }
  104. ],
  105. loadend: false,
  106. loading: false,
  107. loadTitle: '加载更多',
  108. page: 1, //页码
  109. limit: 20, //数量
  110. userInfo: {},
  111. pay_close: false,
  112. pay_order_id: '',
  113. order_id: '',
  114. totalPrice: '0',
  115. delta: 1,
  116. };
  117. },
  118. computed: {
  119. ...mapGetters(['isLogin','viewColor']),
  120. ...configMap(['alipay_open', 'yue_pay_status']),
  121. },
  122. watch: {
  123. alipay_open(n){
  124. this.payMode[1].payStatus = n
  125. },
  126. yue_pay_status(n){
  127. this.payMode[2].payStatus = n
  128. }
  129. },
  130. onLoad: function(option) {
  131. this.delta = option.delta || 0;
  132. },
  133. onUnload: function(){
  134. },
  135. onShow(){
  136. if (this.isLogin === false) {
  137. toLogin()
  138. } else {
  139. this.getIntegralOrderList();
  140. this.getUserInfo();
  141. }
  142. },
  143. methods: {
  144. goDetail: function(id) {
  145. uni.navigateTo({
  146. url: `/pages/points_mall/integral_order_details?order_id=${id}`
  147. })
  148. },
  149. /**
  150. * 获取用户信息
  151. *
  152. */
  153. getUserInfo: function() {
  154. let that = this;
  155. getUserInfo().then(res => {
  156. that.payMode[2].number = res.data.now_money;
  157. })
  158. },
  159. getIntegralOrderList: function() {
  160. var that = this;
  161. if (that.loadend) return;
  162. if (that.loading) return;
  163. that.loading = true;
  164. that.loadTitle = '';
  165. integralOrderList({
  166. page: that.page,
  167. limit: that.limit
  168. })
  169. .then(res => {
  170. let loadend = res.data.list.length < that.limit;
  171. that.loadend = loadend;
  172. that.loading = false;
  173. that.loadTitle = loadend ? '已全部加载' : '加载更多';
  174. that.exchangeList.push.apply(that.exchangeList, res.data.list);
  175. that.page++;
  176. })
  177. .catch(res => {
  178. that.$util.Tips({
  179. title: res
  180. })
  181. });
  182. },
  183. /**
  184. * 打开支付组件
  185. *
  186. */
  187. goPay: function(item) {
  188. this.$set(this, 'pay_close', true);
  189. this.order_id = item.order_id;
  190. this.pay_order_id = item.group_order_id.toString()
  191. this.$set(this, 'totalPrice', item.pay_price);
  192. },
  193. /**
  194. * 支付成功回调
  195. *
  196. */
  197. pay_complete: function() {
  198. this.loadend = false;
  199. this.page = 1;
  200. this.$set(this, 'exchangeList', []);
  201. this.pay_close = false;
  202. this.pay_order_id = '';
  203. this.getIntegralOrderList();
  204. },
  205. /**
  206. * 支付失败回调
  207. *
  208. */
  209. pay_fail: function() {
  210. this.pay_close = false;
  211. this.pay_order_id = '';
  212. },
  213. /**
  214. * 关闭支付弹窗
  215. *
  216. */
  217. payClose: function() {
  218. this.$set(this, 'pay_close', false);
  219. this.pay_order_id = '';
  220. },
  221. /**
  222. * 事件回调
  223. *
  224. */
  225. onChangeFun: function(e) {
  226. let opt = e;
  227. let action = opt.action || null;
  228. let value = opt.value != undefined ? opt.value : null;
  229. (action && this[action]) && this[action](value);
  230. },
  231. /**
  232. * 去订单详情
  233. */
  234. goOrderDetails: function(order_id) {
  235. let self = this
  236. if (!order_id) return that.$util.Tips({
  237. title: '缺少订单号无法查看订单详情'
  238. });
  239. uni.navigateTo({
  240. url: '/pages/points_mall/integral_order_details?order_id=' + order_id
  241. })
  242. },
  243. /*查看物流*/
  244. getLogistics(order_id) {
  245. uni.navigateTo({
  246. url: `/pages/users/goods_logistics/index?orderId=${order_id}`
  247. })
  248. },
  249. /**
  250. * 删除订单
  251. */
  252. delOrder: function(order_id, index, idx) {
  253. let that = this;
  254. uni.showModal({
  255. title: '提示',
  256. content: '确定删除该记录吗?',
  257. success: function (res) {
  258. if (res.confirm) {
  259. integralOrderDelete(order_id).then(res=>{
  260. that.exchangeList[index]['orderProduct'].splice(idx,1);
  261. that.$util.Tips({
  262. title: '删除成功'
  263. });
  264. }).catch(err => {
  265. return that.$util.Tips({
  266. title: err
  267. });
  268. })
  269. } else if (res.cancel) {
  270. console.log('用户点击取消');
  271. }
  272. }
  273. });
  274. },
  275. },
  276. onReachBottom() {
  277. this.getIntegralOrderList();
  278. }
  279. };
  280. </script>
  281. <style lang="scss">
  282. .exchange-record .item {
  283. background-color: #fff;
  284. margin: 10rpx 30rpx;
  285. border-radius: 6rpx;
  286. .exchange_record-time {
  287. color: #333333;
  288. border-bottom: 1px solid #EEEEEE;
  289. padding: 22rpx 30rpx;
  290. display: flex;
  291. justify-content: space-between;
  292. .status {
  293. color: var(--view-theme);
  294. }
  295. }
  296. }
  297. .exchange-record .item .picTxt {
  298. border-bottom: 1px solid #f0f0f0;
  299. padding: 30rpx 30upx;
  300. }
  301. .exchange-record .item .picTxt .pictrue {
  302. width: 120rpx;
  303. height: 120rpx;
  304. }
  305. .exchange-record .item .picTxt .pictrue image {
  306. width: 100%;
  307. height: 100%;
  308. border-radius: 6upx;
  309. }
  310. .exchange-record .item .picTxt .text {
  311. width: 470upx;
  312. font-size: 30upx;
  313. color: #282828;
  314. }
  315. .exchange-record .item .picTxt .text .time {
  316. font-size: 24upx;
  317. color: #868686;
  318. justify-content: left !important;
  319. }
  320. .exchange-record .item .picTxt .text .successTxt {
  321. font-size: 24rpx;
  322. }
  323. .exchange-record .item .picTxt .text .endTxt {
  324. font-size: 24rpx;
  325. color: #999;
  326. }
  327. .exchange-record .item .picTxt .text .money {
  328. font-size: 24upx;
  329. }
  330. .exchange-record .item .picTxt .text .money .num {
  331. font-size: 32upx;
  332. font-weight: bold;
  333. }
  334. .exchange-record .item .picTxt .text .money .symbol {
  335. font-weight: bold;
  336. }
  337. .exchange-record .item .bottom {
  338. height: 100upx;
  339. padding: 0 30upx;
  340. font-size: 27upx;
  341. }
  342. .exchange-record .item .bottom .purple {
  343. color: #f78513;
  344. }
  345. .exchange-record .item .bottom .end {
  346. color: #999;
  347. }
  348. .exchange-record .item .bottom .success {
  349. color: #e93323;
  350. }
  351. .exchange-record .item .bottom .bnt {
  352. font-size: 27upx;
  353. color: #fff;
  354. width: 176upx;
  355. height: 60upx;
  356. border-radius: 32upx;
  357. text-align: center;
  358. line-height: 60upx;
  359. }
  360. .exchange-record .item .bottom .bnt.cancel {
  361. color: #aaa;
  362. border: 1px solid #ddd;
  363. }
  364. .exchange-record .item .bottom .bnt~.bnt {
  365. margin-left: 18upx;
  366. }
  367. .exchange-record .item .bottom .bg-colort {
  368. background-color: var(--view-theme);
  369. }
  370. .gray-sty {
  371. width: 100%;
  372. font-size: 24rpx;
  373. color: #999999;
  374. }
  375. </style>