refundlist.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view>
  3. <!--mine/refund/refund.wxml-->
  4. <block v-if="pageList.length > 0">
  5. <view v-for="(item, index) in pageList" :key="index" class="lists">
  6. <view :data-id="item.id">
  7. <view class="ddbh">
  8. <view class="dflex id">订单编号:{{item.id}}
  9. <!-- <view class="tihuoma" wx:if="{{item.mode == 1 && item.state < 8 && item.state >= 1}}">提货码:<text>{{item.code}}</text></view> -->
  10. </view>
  11. <image src="/static/pages/images/jishida.png" class="type" v-if="item.orderType == 5"></image>
  12. <image src="/mine/static/mine/images/tuangou.png" class="type" v-if="item.orderType == 2"></image>
  13. <image src="/mine/static/mine/images/pingtuan.png" class="type" v-if="item.orderType == 4"></image>
  14. <image src="/mine/static/mine/images/kanjia.png" class="type" v-if="item.orderType == 7"></image>
  15. </view>
  16. <!-- <view class="ddbh" wx:if="{{item.mode ==1}}">
  17. <view class="dflex" bindtap="showOrder">
  18. {{merchantName}}
  19. </view>
  20. <image src="/pages/images/delete.png" class="type" bindtap="deleteOrder"></image>
  21. </view> -->
  22. <view v-for="(item, index2) in item.products" :key="index2" class="li" @tap="showOrder">
  23. <image :src="item.pic + '?x-oss-process=style/w160'" mode="aspectFit" class="cimg"></image>
  24. <view class="zhinfo">
  25. <view class="zhtit">{{item.title}}</view>
  26. <view v-if="item.propertiesList" class="guigecontent">规格:
  27. <text v-for="(itemGuige, index) in item.propertiesList" :key="index" class="guige" decode="true">{{itemGuige.value}}&nbsp;
  28. </text>
  29. </view>
  30. <view class="jiage">
  31. <view class="zhjia"><text class="money">¥</text><text class="size">{{item.salePrice}}</text></view>
  32. <view class="num">x{{item.quantity}}</view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="total">
  37. <!-- <view>共{{item.count}}件商品</view> -->
  38. <view>总金额:<text>¥{{item.money}}</text></view>
  39. </view>
  40. </view>
  41. <view class="status">
  42. <!-- <image src="/mine/images/refund.png" /> -->
  43. <block v-if="item.state>=40&&item.state<=41">
  44. <image src="/mine/static/mine/images/refund.png"></image>
  45. <view class="flex">退款中</view>
  46. </block>
  47. <block v-if="item.state==42">
  48. <image src="/mine/static/mine/images/refund.png"></image>
  49. <view class="flex">退款失败</view>
  50. </block>
  51. <block v-if="item.state==43">
  52. <image src="/mine/static/mine/images/refund.png"></image>
  53. <view class="flex">已退款</view>
  54. </block>
  55. <view class="sta-btn" @tap="deleteOrder" :data-index="index" :data-id="item.id">删除记录</view>
  56. <view @tap="sub" :data-index="index" class="sta-btn red" :data-id="item.id">查看详情</view>
  57. </view>
  58. </view>
  59. </block>
  60. <view class="nodata" v-if="ishow">
  61. <image :src="picUrlss+'empty_dd.png'"></image>
  62. <text>还没有订单哦</text>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. // mine/refund/refund.js
  68. const app = getApp();
  69. const req = require("../../../utils/request.js");
  70. export default {
  71. data() {
  72. return {
  73. picUrlss: req.public.picUrls,
  74. form: {
  75. page: 1,
  76. size: 5
  77. },
  78. pageList: [],
  79. isLoad: true,
  80. ishow: false
  81. };
  82. },
  83. components: {},
  84. props: {},
  85. /**
  86. * 生命周期函数--监听页面加载
  87. */
  88. onLoad: function (options) {
  89. this.getList();
  90. /**
  91. * 获取门店名称
  92. */
  93. },
  94. /**
  95. * 生命周期函数--监听页面初次渲染完成
  96. */
  97. onReady: function () {},
  98. /**
  99. * 生命周期函数--监听页面显示
  100. */
  101. onShow: function () {},
  102. /**
  103. * 生命周期函数--监听页面隐藏
  104. */
  105. onHide: function () {},
  106. /**
  107. * 生命周期函数--监听页面卸载
  108. */
  109. onUnload: function () {},
  110. /**
  111. * 页面相关事件处理函数--监听用户下拉动作
  112. */
  113. onPullDownRefresh: function () {},
  114. /**
  115. * 页面上拉触底事件的处理函数
  116. */
  117. onReachBottom: function () {
  118. this.form.page++;
  119. this.getList();
  120. // console.log(1);
  121. }
  122. /**
  123. * 用户点击右上角分享
  124. */
  125. ,
  126. methods: {
  127. /**
  128. * 获取退款列表
  129. */
  130. getList() {
  131. let isShowLoading = false;
  132. if (this.form.page == 1 && !isShowLoading) {
  133. req.loadIng('加载中');
  134. isShowLoading = true;
  135. }
  136. if (!this.isLoad) return false;
  137. this.isLoad = false;
  138. let that = this;
  139. req.getRequest('/api/order/list', this.form, data => {
  140. // console.log(data);
  141. if (data && data.length == 10) this.isLoad = true;
  142. if (that.form.page > 1) data = that.pageList.concat(data); // this.setData({pageList:data})
  143. let refund = [];
  144. data.forEach(res => {
  145. if (res.state >= 40) {
  146. // console.log(res);
  147. req.getRequest('/api/order/detail', {
  148. id: res.id
  149. }, data => {
  150. that.setData(data);
  151. });
  152. refund.push(res);
  153. }
  154. }); // console.log(this.data.pageList)
  155. // console.log(refund);
  156. this.setData({
  157. pageList: refund
  158. });
  159. if (!this.pageList) {
  160. that.setData({
  161. ishow: true
  162. });
  163. } else {
  164. that.setData({
  165. ishow: false
  166. });
  167. }
  168. if (isShowLoading) {
  169. uni.hideLoading();
  170. isShowLoading = false;
  171. }
  172. });
  173. // console.log(this.pageList);
  174. },
  175. /**
  176. * 获取门店名称
  177. */
  178. /**
  179. * 删除订单
  180. */
  181. deleteOrder() {
  182. let that = this;
  183. req.msgConfirm('确定删除该订单?', () => {
  184. req.postRequest('/api/order/delete', {
  185. id: this.id
  186. }, () => {
  187. let pages = getCurrentPages();
  188. // console.log(pages);
  189. var prevPage = pages[pages.length - 1];
  190. // console.log(prevPage);
  191. let pageList = prevPage.data.pageList;
  192. pageList.splice(pageList.findIndex(it => it.id == that.id), 1);
  193. prevPage.$vm.setData({
  194. pageList: pageList
  195. }); // wx.startPullDownRefresh()
  196. // that.onShow()
  197. // wx.navigateBack()
  198. });
  199. });
  200. },
  201. sub(event) {
  202. uni.navigateTo({
  203. url: '/mine/refund/refundDetails/refundDetails?id=' + event.target.dataset.id
  204. });
  205. }
  206. }
  207. };
  208. </script>
  209. <style>
  210. @import "./refundlist.css";
  211. </style>