diffOrderDetail.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view>
  3. <view class="supply-order">
  4. <view class="order-title">
  5. <view>补差订单</view>
  6. <view :class="(orderDiff.state != 2 ? 'non-payment' : '') + ' pay-status'">
  7. {{ orderDiff.state == 0 || orderDiff.state == 1 ? '未支付' : orderDiff.state == 2 ? '已支付' : '取消' }}
  8. </view>
  9. </view>
  10. <view class="item-line">
  11. <view class="item-left">补差内容:</view>
  12. <view>{{ orderDiff.difName }}</view>
  13. </view>
  14. <view class="item-line">
  15. <view class="item-left">金额:</view>
  16. <view class="order-amount">¥ {{ orderDiff.difTotalPrice }}</view>
  17. </view>
  18. <view class="item-line">
  19. <view class="item-left">创建时间:</view>
  20. <view class="order-time">{{ orderDiff.createTime }}</view>
  21. </view>
  22. </view>
  23. <view class="supply-list">
  24. <view class="supply-item" v-for="(item, index) in diffItemList" :key="index">
  25. <view class="item-title">补差项{{ index + 1 }}</view>
  26. <view class="item-line">
  27. <view class="item-left">补差内容:</view>
  28. <view>{{ item.itemName }}</view>
  29. </view>
  30. <view class="item-line">
  31. <view class="item-left">份数:</view>
  32. <view>{{ item.number }}</view>
  33. </view>
  34. <view class="item-line">
  35. <view class="item-left">金额:</view>
  36. <view>¥ {{ item.difTotalPrice }}</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="supply-bottom" v-if="orderDiff.state == 0 || orderDiff.state == 1">
  41. <view class="total-amount">
  42. <view class="title">总计补差金额</view>
  43. <view>
  44. ¥
  45. <text>{{ orderDiff.difTotalPrice }}</text>
  46. </view>
  47. </view>
  48. <view class="order-button" @tap="goPay">立即支付</view>
  49. </view>
  50. </view>
  51. </template>
  52. <script module="utils" lang="wxs" src="@/utils/formatFuc.wxs"></script>
  53. <script>
  54. const app = getApp();
  55. const util = require('../../utils/util');
  56. const api = require('../../config/api.js');
  57. export default {
  58. data() {
  59. return {
  60. difNo: '',
  61. orderDiff: {
  62. state: 0,
  63. difName: '',
  64. difTotalPrice: '',
  65. createTime: ''
  66. },
  67. diffItemList: []
  68. };
  69. }
  70. /**
  71. * 生命周期函数--监听页面加载
  72. */,
  73. onLoad: function (options) {
  74. console.log(options);
  75. if (options.difNo) {
  76. this.setData({
  77. difNo: options.difNo
  78. });
  79. }
  80. if (options.scene) {
  81. let scene = decodeURIComponent(options.scene);
  82. let difNo = scene.split('=')[1];
  83. this.setData({
  84. difNo: difNo
  85. });
  86. }
  87. },
  88. /**
  89. * 生命周期函数--监听页面初次渲染完成
  90. */
  91. onReady: function () {},
  92. /**
  93. * 生命周期函数--监听页面显示
  94. */
  95. onShow: function () {
  96. this.getDiffOrderDetail();
  97. },
  98. onHide: function () {},
  99. onUnload: function () {},
  100. /**
  101. * 页面相关事件处理函数--监听用户下拉动作
  102. */
  103. onPullDownRefresh: function () {
  104. uni.showNavigationBarLoading(); //在标题栏中显示加载
  105. this.getDiffOrderDetail();
  106. uni.hideNavigationBarLoading(); //完成停止加载
  107. uni.stopPullDownRefresh(); //停止下拉刷新
  108. },
  109. /**
  110. * 页面上拉触底事件的处理函数
  111. */
  112. onReachBottom: function () {},
  113. /**
  114. * 用户点击右上角分享
  115. */
  116. onShareAppMessage: function () {},
  117. methods: {
  118. getDiffOrderDetail() {
  119. uni.showLoading({
  120. title: '加载中...'
  121. });
  122. util.request(
  123. api.getDiffDetail,
  124. {
  125. diffOrderNo: this.difNo
  126. },
  127. 'GET'
  128. )
  129. .then((res) => {
  130. uni.hideLoading();
  131. if (res.errno === 0) {
  132. this.setData({
  133. orderDiff: res.data.orderDiff,
  134. diffItemList: res.data.diffItemList
  135. });
  136. } else {
  137. uni.showToast({
  138. title: res.errmsg,
  139. icon: 'none',
  140. duration: 3000,
  141. mask: true
  142. });
  143. }
  144. })
  145. .catch((err) => {
  146. uni.hideLoading();
  147. });
  148. },
  149. goPay() {
  150. let that = this;
  151. uni.showLoading({
  152. title: '加载中'
  153. });
  154. util.request(api.prepayDiff, {
  155. diffOrderNo: this.difNo
  156. })
  157. .then((res) => {
  158. uni.hideLoading();
  159. if (res.errno === 0) {
  160. let payParam = res.data;
  161. uni.requestPayment({
  162. timeStamp: payParam.timeStamp,
  163. nonceStr: payParam.nonceStr,
  164. package: payParam.packageValue,
  165. signType: payParam.signType,
  166. paySign: payParam.paySign,
  167. success: function (res) {
  168. console.log('支付过程成功');
  169. uni.showToast({
  170. title: '支付成功',
  171. duration: 3000,
  172. mask: true
  173. });
  174. setTimeout(() => {
  175. that.getDiffOrderDetail();
  176. }, 4000);
  177. },
  178. fail: function (res) {
  179. console.log('支付过程失败');
  180. util.showErrorToast('支付失败');
  181. },
  182. complete: function (res) {
  183. console.log('支付过程结束');
  184. }
  185. });
  186. }
  187. })
  188. .catch((err) => {
  189. console.log(err);
  190. uni.hideLoading();
  191. });
  192. }
  193. }
  194. };
  195. </script>
  196. <style>
  197. page {
  198. background: #f3f3f3;
  199. color: #333;
  200. box-sizing: border-box;
  201. width: 750rpx;
  202. padding: 6rpx 0 400rpx;
  203. }
  204. text,
  205. view {
  206. color: #333;
  207. font-size: 28rpx;
  208. box-sizing: border-box;
  209. }
  210. .supply-order {
  211. background: #fff;
  212. margin-bottom: 28rpx;
  213. padding-bottom: 32rpx;
  214. }
  215. .order-title {
  216. height: 80rpx;
  217. padding: 0 24rpx 0 48rpx;
  218. border-bottom: 1rpx solid #f3f3f3;
  219. color: #666666;
  220. font-size: 28rpx;
  221. margin-bottom: 20rpx;
  222. display: flex;
  223. align-items: center;
  224. justify-content: space-between;
  225. }
  226. .pay-status {
  227. font-weight: 600;
  228. color: #09afff;
  229. }
  230. .non-payment.pay-status {
  231. color: #ff004e;
  232. }
  233. .item-line .order-amount {
  234. color: #191919;
  235. }
  236. .item-line .order-time {
  237. color: #191919;
  238. }
  239. .supply-item {
  240. background: #fff;
  241. margin-bottom: 10rpx;
  242. padding-bottom: 10rpx;
  243. }
  244. .item-title {
  245. height: 80rpx;
  246. line-height: 80rpx;
  247. padding-left: 48rpx;
  248. border-bottom: 1rpx solid #f3f3f3;
  249. color: #666666;
  250. font-size: 28rpx;
  251. margin-bottom: 20rpx;
  252. }
  253. .item-line {
  254. display: flex;
  255. justify-content: space-between;
  256. align-items: center;
  257. padding: 0 24rpx 0 48rpx;
  258. height: 48rpx;
  259. margin-bottom: 4rpx;
  260. }
  261. .item-line view {
  262. font-size: 28rpx;
  263. color: #666;
  264. }
  265. .item-line view.item-left {
  266. color: #999;
  267. }
  268. .supply-bottom {
  269. position: fixed;
  270. bottom: 0;
  271. left: 0;
  272. right: 0;
  273. padding-bottom: constant(safe-area-inset-bottom);
  274. padding-bottom: env(safe-area-inset-bottom);
  275. display: flex;
  276. flex-direction: column;
  277. align-items: center;
  278. background: #fff;
  279. }
  280. .total-amount {
  281. border-bottom: 8rpx solid #f3f3f3;
  282. display: flex;
  283. height: 96rpx;
  284. padding: 0 24rpx 8rpx 34rpx;
  285. justify-content: space-between;
  286. align-items: center;
  287. width: 750rpx;
  288. }
  289. .total-amount text {
  290. font-weight: bold;
  291. }
  292. .del-item {
  293. width: 198rpx;
  294. height: 58rpx;
  295. background: #ff9f18;
  296. border-radius: 8rpx;
  297. font-size: 30rpx;
  298. text-align: center;
  299. line-height: 58rpx;
  300. color: #fff;
  301. margin: 30rpx auto;
  302. }
  303. .item-operate-special {
  304. display: flex;
  305. align-items: center;
  306. justify-content: center;
  307. padding: 30rpx 0;
  308. }
  309. .disable-item {
  310. width: 198rpx;
  311. height: 58rpx;
  312. background: #b7b7b7;
  313. border-radius: 8rpx;
  314. font-size: 30rpx;
  315. text-align: center;
  316. line-height: 58rpx;
  317. color: #fff;
  318. margin-right: 90rpx;
  319. }
  320. .item-operate-special .add-item {
  321. margin: 0;
  322. }
  323. .order-button {
  324. width: 702rpx;
  325. height: 98rpx;
  326. line-height: 98rpx;
  327. background: #1677ff;
  328. color: #ffffff;
  329. font-size: 36rpx;
  330. margin: 24rpx 24rpx 0;
  331. text-align: center;
  332. font-weight: 400;
  333. border-radius: 8rpx;
  334. }
  335. </style>