orderEit.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class="home-getOrder">
  3. <form class="form" @submit="orderSubmit">
  4. <view v-if="show" 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="note" disabled :value="note"/>
  31. </view>
  32. <view class="select-input">
  33. <input class="input" style="display:none;" />
  34. <text>退款时间:</text><input class="input" name="refundDate" disabled :value="refundDate"/>
  35. </view>
  36. <view class="select-input">
  37. <input class="input" style="display:none;" />
  38. <text>已退款金额:</text><input class="input" name="refundPrice" disabled :value="refundPrice" />
  39. </view>
  40. <view class="select-input">
  41. <input class="input" style="display:none;" />
  42. <text>订单状态:</text><input class="input" name="status" disabled :value="status==1?('已支付'):(status==2?'退款中':'已退款')" />
  43. </view>
  44. <view class="select-input">
  45. <input class="input" style="display:none;" />
  46. <text>退款金额:</text><input class="input2" @focus="setStyle()" @blur="setStyle2()" v-model="refundAmount" />
  47. </view>
  48. <p id="p2" class="p2" :style="{display:showOrNo}">请慎重对待!</p>
  49. <view class="select-input">
  50. <input class="input" style="display:none;" />
  51. <text>PS:退款金额可修改</text>
  52. </view>
  53. <view class="btn-area">
  54. <button type="primary" formType="submit" >退款</button>
  55. </view>
  56. </form>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data(){
  62. return{
  63. show: true,
  64. order:null,
  65. sn:null,
  66. clientId:null,
  67. productName:null,
  68. price:null,
  69. payDate:null,
  70. refundDate:null,
  71. status:null,
  72. altMainBalance:0,
  73. refundAmount:0,
  74. refundPrice:0,
  75. showOrNo: null,
  76. note:null,
  77. production:0
  78. }
  79. },
  80. onLoad: function(option) {
  81. const order = JSON.parse(decodeURIComponent(option.order));
  82. this.order = order;
  83. if(order.type==1){
  84. this.production = order.agencyProportion;
  85. }
  86. if(order.type==2){
  87. this.production = order.merchantProportion;
  88. }
  89. if(order.type==3){
  90. this.production = order.personageProportion;
  91. }
  92. if(order.payPlatform == 3) {
  93. this.show = false;
  94. }
  95. this.sn = order.sn;
  96. this.clientId = order.clientId;
  97. this.productName = order.productName;
  98. this.price = order.price;
  99. this.payDate = order.payDate;
  100. this.refundDate = order.refundDate;
  101. this.status = order.status;
  102. this.note = order.note;
  103. this.refundPrice = order.refundAmount;
  104. this.refundAmount = order.price;
  105. },
  106. onShow() {
  107. this.mch();
  108. // console.log("订单详情")
  109. },
  110. methods: {
  111. orderSubmit(e) {
  112. var price = this.price;
  113. var production = this.production;
  114. var altMainBalance = this.altMainBalance;
  115. var refusePrice = price*production/100;
  116. console.log("refusePrice="+refusePrice)
  117. if(altMainBalance<refusePrice.toFixed(2)){
  118. uni.showToast({
  119. title: '余额不足',
  120. duration: 2000
  121. });
  122. return;
  123. }
  124. uni.showModal({
  125. title: '退款',
  126. content: '确定执行退款操作?',
  127. success: (res) => {
  128. if (res.confirm) {
  129. var order = this.order;
  130. var refundAmount = this.refundAmount;
  131. var token = uni.getStorageSync("token");
  132. if(order.payPlatform != null && order.payPlatform == '3') {
  133. //如果为直接对接微信支付
  134. uni.request({
  135. url: this.serverurl + '/tWeixinPay/refund',
  136. data: {
  137. "sn": order.sn,
  138. "refusePrice":refundAmount
  139. },
  140. header: {
  141. 'token': token
  142. },
  143. method: "GET",
  144. success: (res) => {
  145. var message = res.data.message;
  146. if(res.data.code){
  147. this.status = 2;
  148. }
  149. uni.showToast({
  150. title: message,
  151. duration: 3000
  152. });
  153. },
  154. });
  155. }else{
  156. uni.request({
  157. url: this.serverurl + '/TOrder/refund',
  158. data: {
  159. "sn": order.sn,
  160. "id": order.id,
  161. "refundAmount":refundAmount
  162. },
  163. header: {
  164. 'token': token
  165. },
  166. method: "POST",
  167. success: (res) => {
  168. var message = res.data.message;
  169. if(res.data.code){
  170. this.status = 2;
  171. }
  172. uni.showToast({
  173. title: message,
  174. duration: 3000
  175. });
  176. },
  177. });
  178. }
  179. } else if (res.cancel) {
  180. // console.log('用户点击取消');
  181. }
  182. }
  183. });
  184. },
  185. mch(){
  186. var token = uni.getStorageSync("token");
  187. var globalUser = uni.getStorageSync("globalUser");
  188. uni.request({
  189. url: this.serverurl + '/TJoinpayMch/getMch',
  190. data: {
  191. "adminId": globalUser.id,
  192. "bizCode":this.order.id
  193. },
  194. header: {
  195. 'token': token
  196. },
  197. method: "POST",
  198. success: (res) => {
  199. var date = res.data.data;
  200. this.altMainBalance = date.altMainBalance;
  201. },
  202. });
  203. },
  204. setStyle() {
  205. this.showOrNo = "block";
  206. },
  207. setStyle2() {
  208. this.showOrNo = "none";
  209. }
  210. }
  211. }
  212. </script>
  213. <style lang="scss">
  214. .home-getOrder {
  215. padding-top: 50upx;
  216. }
  217. .select-input {
  218. display: flex;
  219. flex-direction: row;
  220. justify-content: flex-start;
  221. font-size: 16px;
  222. border-bottom: 1px solid;
  223. margin: 20upx 30upx 30upx 30upx;
  224. // box-shadow: 0upx 0upx 20upx #D3D3D3;
  225. text {
  226. margin-left: 30upx;
  227. }
  228. input {
  229. padding-left: 20upx;
  230. background-color: #FFFFFF;
  231. width: 400upx;
  232. height: 50upx;
  233. // box-shadow: 0upx 0upx 20upx #D3D3D3;
  234. // border-radius: 5upx;
  235. }
  236. }
  237. .form {
  238. width: calc(100% - 100upx);
  239. padding: 50upx;
  240. // .section{
  241. // margin:50upx 0;
  242. // }
  243. .btn-area {
  244. margin-top: 50upx;
  245. padding: 50upx;
  246. button {
  247. background-color: #007AFF;
  248. }
  249. }
  250. }
  251. .input2{
  252. box-shadow: 0upx 0upx 20upx #D3D3D3;
  253. border-radius: 5upx;
  254. }
  255. .p2 {
  256. color: #DD524D;
  257. display: none;
  258. width: 300upx;
  259. height: 50upx;
  260. border: 1px;
  261. margin-left: auto;
  262. margin-right: auto;
  263. padding-left: 30upx;
  264. }
  265. </style>