orderEit.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="home-getOrder">
  3. <form class="form" @submit="orderSubmit">
  4. <view class="select-input">
  5. <input class="input" style="display:none;" />
  6. <text>账户余额:</text><input class="input" name="altMainBalance" disabled :value="altMainBalance"/>
  7. </view>
  8. <view class="select-input">
  9. <input class="input" style="display:none;" />
  10. <text>订单编号:</text><input class="input" name="sn" disabled :value="sn"/>
  11. </view>
  12. <view class="select-input">
  13. <input class="input" style="display:none;" />
  14. <text>设备编码:</text><input class="input" name="clientId" :value="clientId" />
  15. </view>
  16. <view class="select-input">
  17. <input class="input" style="display:none;" />
  18. <text>商品名称:</text><input class="input" name="productName" disabled :value="productName" />
  19. </view>
  20. <view class="select-input">
  21. <input class="input" style="display:none;" />
  22. <text>商品价格:</text><input class="input" name="price" disabled :value="price" />
  23. </view>
  24. <view class="select-input">
  25. <input class="input" style="display:none;" />
  26. <text>支付时间:</text><input class="input" name="payDate" disabled :value="payDate"/>
  27. </view>
  28. <view class="select-input">
  29. <input class="input" style="display:none;" />
  30. <text>退款时间:</text><input class="input" name="refundDate" disabled :value="refundDate"/>
  31. </view>
  32. <view class="select-input">
  33. <input class="input" style="display:none;" />
  34. <text>订单状态:</text><input class="input" name="status" disabled :value="status==1?('已支付'):(status==2?'退款中':'已退款')" />
  35. </view>
  36. <view class="btn-area">
  37. <button type="primary" formType="submit" >退款</button>
  38. </view>
  39. </form>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data(){
  45. return{
  46. order:null,
  47. sn:null,
  48. clientId:null,
  49. productName:null,
  50. price:null,
  51. payDate:null,
  52. refundDate:null,
  53. status:null,
  54. altMainBalance:0
  55. }
  56. },
  57. onLoad: function(option) {
  58. const order = JSON.parse(decodeURIComponent(option.order));
  59. this.order = order;
  60. this.sn = order.sn;
  61. this.clientId = order.clientId;
  62. this.productName = order.productName;
  63. this.price = order.price;
  64. this.payDate = order.payDate;
  65. this.refundDate = order.refundDate;
  66. this.status = order.status;
  67. },
  68. onShow() {
  69. this.mch();
  70. // console.log("订单详情")
  71. },
  72. methods: {
  73. orderSubmit(e) {
  74. var price = this.price;
  75. var altMainBalance = this.altMainBalance;
  76. if(altMainBalance<price){
  77. uni.showToast({
  78. title: '余额不足',
  79. duration: 2000
  80. });
  81. return;
  82. }
  83. uni.showModal({
  84. title: '退款',
  85. content: '确定执行退款操作?',
  86. success: (res) => {
  87. if (res.confirm) {
  88. var order = this.order;
  89. var token = uni.getStorageSync("token");
  90. uni.request({
  91. url: this.serverurl + '/TOrder/refund',
  92. data: {
  93. "sn": order.sn,
  94. "id": order.id,
  95. },
  96. header: {
  97. 'token': token
  98. },
  99. method: "POST",
  100. success: (res) => {
  101. var message = res.data.message;
  102. if(res.data.code){
  103. this.status = 2;
  104. }
  105. uni.showToast({
  106. title: message,
  107. duration: 3000
  108. });
  109. },
  110. });
  111. } else if (res.cancel) {
  112. // console.log('用户点击取消');
  113. }
  114. }
  115. });
  116. },
  117. mch(){
  118. var token = uni.getStorageSync("token");
  119. var globalUser = uni.getStorageSync("globalUser");
  120. uni.request({
  121. url: this.serverurl + '/TJoinpayMch/getMch',
  122. data: {
  123. "adminId": globalUser.id,
  124. },
  125. header: {
  126. 'token': token
  127. },
  128. method: "POST",
  129. success: (res) => {
  130. var date = res.data.data;
  131. this.altMainBalance = date.altMainBalance;
  132. },
  133. });
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss">
  139. .home-getOrder {
  140. padding-top: 50upx;
  141. }
  142. .select-input {
  143. display: flex;
  144. flex-direction: row;
  145. justify-content: flex-start;
  146. font-size: 16px;
  147. border-bottom: 1px solid;
  148. margin: 20upx 30upx 30upx 30upx;
  149. // box-shadow: 0upx 0upx 20upx #D3D3D3;
  150. text {
  151. margin-left: 30upx;
  152. }
  153. input {
  154. padding-left: 20upx;
  155. background-color: #FFFFFF;
  156. width: 400upx;
  157. height: 50upx;
  158. // box-shadow: 0upx 0upx 20upx #D3D3D3;
  159. // border-radius: 5upx;
  160. }
  161. }
  162. .form {
  163. width: calc(100% - 100upx);
  164. padding: 50upx;
  165. // .section{
  166. // margin:50upx 0;
  167. // }
  168. .btn-area {
  169. margin-top: 50upx;
  170. padding: 50upx;
  171. button {
  172. background-color: #007AFF;
  173. }
  174. }
  175. }
  176. </style>