金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

274 lines
7.8 KiB

  1. <template>
  2. <view>
  3. <view id="store-success" v-if="init">
  4. <!-- <view class="pay-status pay-error mx-1px-bottom" wx:if="{{!isOK}}">
  5. 支付失败
  6. </view>-->
  7. <view v-if="!isOK">
  8. <view class="pay-status pay-error">
  9. 支付失败
  10. </view>
  11. <view class="pay-txt">
  12. 如已支付成功请联系客服
  13. </view>
  14. </view>
  15. <view v-if="isOK">
  16. <view class="pay-status pay-ok">
  17. 支付成功
  18. </view>
  19. <view class="pay-txt">
  20. 支付成功查看订单详情
  21. </view>
  22. </view>
  23. <view class="button-box">
  24. <view class="btn left-btn" @tap="queryOrderType" v-if="!isOK && errCount == 1">重新查询</view>
  25. <view class="btn rigth-box">
  26. <view v-if="info.order.type==10" @tap="jump">查看拼团</view>
  27. <view v-else @tap="jump">查看订单</view>
  28. </view>
  29. </view>
  30. <block v-if="isOK">
  31. <view class="order-info">
  32. <view class="order-money mx-1px-bottom">
  33. <view class="left">
  34. 付款金额
  35. </view>
  36. <view class="right">
  37. {{info.order.total_yuan}}
  38. </view>
  39. </view>
  40. <view class="info-list">
  41. <view class="order-item">
  42. <view class="item-left">
  43. 订单编号
  44. </view>
  45. <view class="item-right">
  46. {{info.order.order_no}}
  47. </view>
  48. </view>
  49. <view class="order-item">
  50. <view class="item-left">
  51. 订单时间
  52. </view>
  53. <view class="item-right">
  54. {{info.order.submit_time}}
  55. </view>
  56. </view>
  57. <view class="order-item">
  58. <view class="item-left">
  59. 订单状态
  60. </view>
  61. <view class="item-right">
  62. 支付成功
  63. </view>
  64. </view>
  65. <view class="order-item">
  66. <view class="item-left">
  67. 消耗积分
  68. </view>
  69. <view class="item-right">
  70. {{info.pointInfo.pointUsed}}积分
  71. </view>
  72. </view>
  73. <view class="order-item">
  74. <view class="item-left">
  75. 获得积分
  76. </view>
  77. <view class="item-right">
  78. {{info.pointInfo.pointAdded}}积分
  79. </view>
  80. </view>
  81. <view class="order-item">
  82. <view class="item-left">
  83. 当前积分
  84. </view>
  85. <view class="item-right">
  86. {{info.pointInfo.pointTotal}}积分
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. </block>
  92. <!-- <view class="button-box">
  93. <button type="primary" style="background: {{config.mainColor}}" type="primary" bindtap="jump" wx:if="{{info.order.type==10}}">查看拼团详情</button>
  94. <button type="primary" style="background: {{config.mainColor}}" type="primary" bindtap="jump" wx:else>查看订单详情</button>
  95. &lt;!&ndash;<button type="default">查看积分</button>&ndash;&gt;
  96. </view>-->
  97. </view>
  98. </view>
  99. </template>
  100. <script>
  101. import {pageLogin, getUrl,config,is} from '@/common/js/utils.js';
  102. export default {
  103. data() {
  104. return {
  105. info: {},
  106. order_no: '',
  107. isOK: true,
  108. config: '',
  109. errCount: 0,
  110. formId: '',
  111. accountInfo: '',
  112. init:false
  113. };
  114. },
  115. onLoad(e) {
  116. var gbConfig = this.$cookieStorage.get('globalConfig') || '';
  117. this.config = gbConfig;
  118. this. order_no = e.order_no;
  119. this.amount = e.amount;
  120. this.channel = e.channel;
  121. this.formId = e.formId || '';
  122. if (!e.order_no) {
  123. wx.showModal({
  124. content: '订单参数错误',
  125. showCancel: false
  126. });
  127. return;
  128. }
  129. wx.showLoading();
  130. pageLogin(getUrl(), () => {
  131. setTimeout(() => {
  132. this.queryOrderType(e.order_no);
  133. }, 500);
  134. });
  135. },
  136. components: {},
  137. props: {},
  138. methods: {
  139. jump() {
  140. if (this.info.order && this.info.order.type == 10) {
  141. wx.redirectTo({
  142. url: '/pages/store/collage/collage?multi_groupon_item_id=' + this.info.order.multiGroupon.multi_groupon_items_id
  143. });
  144. } else {
  145. wx.redirectTo({
  146. url: '/pages/order/detail/detail?no=' + this.order_no,
  147. fail: err => {
  148. wx.showModal({
  149. content: '错误,返回首页后重试',
  150. showCancel: false
  151. });
  152. }
  153. });
  154. }
  155. },
  156. queryOrderType(no) {
  157. wx.showLoading();
  158. var token = this.$cookieStorage.get('user_token');
  159. this.$http.post({
  160. api: 'api/shopping/order/paid',
  161. header: {
  162. Authorization: token
  163. },
  164. data: {
  165. order_no: this.order_no,
  166. amount: this.amount,
  167. channel: this.channel,
  168. form_id: this.formId
  169. }
  170. }).then(res => {
  171. if (res.statusCode == 200) {
  172. wx.hideLoading();
  173. res = res.data;
  174. if (res && res.status && res.data.order && res.data.order.pay_status) {
  175. this.info = res.data;
  176. this.isOK = true;
  177. } else {
  178. this.isOK = false;
  179. wx.showModal({
  180. content: res.message || "订单支付失败",
  181. showCancel: false,
  182. success: res => {
  183. if (res.confirm && this.errCount == 2) {
  184. wx.switchTab({
  185. url: '/pages/user/personal/personal'
  186. });
  187. }
  188. }
  189. });
  190. }
  191. this.errCount = this.errCount + 1;
  192. this.init = true;
  193. } else {
  194. this.isOK = false;
  195. this.init = true;
  196. this.errCount = this.errCount + 1
  197. wx.hideLoading();
  198. wx.showModal({
  199. content: "订单支付失败",
  200. showCancel: false,
  201. success: res => {
  202. if (res.confirm && this.errCount == 2) {
  203. wx.switchTab({
  204. url: '/pages/user/personal/personal'
  205. });
  206. }
  207. }
  208. });
  209. }
  210. }).catch(rej => {
  211. wx.hideLoading();
  212. this.isOK = false;
  213. this.init = true;
  214. this.errCount = this.errCount + 1
  215. wx.showModal({
  216. content: "订单支付失败",
  217. showCancel: false,
  218. success: res => {
  219. if (res.confirm && this.errCount == 2) {
  220. wx.switchTab({
  221. url: '/pages/user/personal/personal'
  222. });
  223. }
  224. }
  225. });
  226. });
  227. },
  228. setData: function (obj) {
  229. let that = this;
  230. let keys = [];
  231. let val, data;
  232. Object.keys(obj).forEach(function (key) {
  233. keys = key.split('.');
  234. val = obj[key];
  235. data = that.$data;
  236. keys.forEach(function (key2, index) {
  237. if (index + 1 == keys.length) {
  238. that.$set(data, key2, val);
  239. } else {
  240. if (!data[key2]) {
  241. that.$set(data, key2, {});
  242. }
  243. }
  244. data = data[key2];
  245. });
  246. });
  247. }
  248. },
  249. computed: {},
  250. watch: {}
  251. };
  252. </script>
  253. <style rel="stylesheet/less" lang="less">
  254. @import "success";
  255. </style>