order-history.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="container history clearfix">
  3. <view class="history-main">
  4. <view v-if="isEmpty" class="empty-container">
  5. <view class="txt">暂无数据</view>
  6. </view>
  7. <view v-else class="history-list">
  8. <scroll-view scroll-y="true" >
  9. <view class="list" v-for="(item, index) in historyList" :key="index">
  10. <view class="list-left">
  11. <view class="list-p">订单号:<text class="txt">{{item.orderNo}}</text><text v-if="item.payStatus == 1" class="tag">协销</text></view>
  12. <view class="list-p">总金额:<text class="txt">¥{{orderPriceToFixed(item.orderTotalFee)}}</text></view>
  13. <view class="list-p">数量(赠):<text class="txt">{{item.productCount}}</text></view>
  14. </view>
  15. <view class="list-opea">
  16. <view class="opea-p">{{orderStateExp(item.status)}}</view>
  17. <view class="opea-type-dell" @click.stop="orderDetiles(item.orderID)">
  18. <text>查看详情</text>
  19. </view>
  20. </view>
  21. </view>
  22. <!--加载loadding-->
  23. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  24. <tui-nomore :visible="!pullUpOn" bgcolor="#F7F7F7" :text='nomoreText'></tui-nomore>
  25. <!--加载loadding-->
  26. </scroll-view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import authorize from '@/common/config/authorize.js'
  33. import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
  34. import tuiNomore from "@/components/tui-components/nomore/nomore"
  35. import { getSellerClubOrderList } from "@/api/seller.js"
  36. export default {
  37. components:{
  38. tuiLoadmore,
  39. tuiNomore,
  40. },
  41. data() {
  42. return {
  43. clubID:'',
  44. serviceProviderId:'',
  45. isEmpty:false,
  46. nomoreText: '上拉显示更多',
  47. pageNum:1,
  48. pageSize:10,
  49. hasNextPage:false,
  50. loadding: false,
  51. pullUpOn: true,
  52. pullFlag: true,
  53. allowDataStatus:true,
  54. wrapperHeight:'100%',
  55. scrollHeight:'',
  56. deleteAddressId:'',
  57. currPage:'',//当前页面
  58. prevPage:'',//上一个页面
  59. tabCurrentIndex:0,
  60. historyList:[],
  61. }
  62. },
  63. onLoad(option){
  64. console.log(option)
  65. this.clubID = option.clubID
  66. },
  67. methods: {
  68. inithistoryList(){
  69. let params = {clubID:this.clubID,serviceProviderId:this.serviceProviderId,pageNum:1,pageSize:this.pageSize};
  70. getSellerClubOrderList(params).then(response =>{
  71. let responseData = response.data
  72. if(responseData.results&&responseData.results.length > 0){
  73. this.isEmpty = false
  74. this.hasNextPage = response.data.hasNextPage
  75. this.historyList =responseData.results
  76. this.pullFlag = false;
  77. setTimeout(()=>{this.pullFlag = true;},500)
  78. if(this.hasNextPage){
  79. this.pullUpOn = false
  80. this.nomoreText = '上拉显示更多'
  81. }else{
  82. this.pullUpOn = true
  83. this.loadding = false
  84. this.nomoreText = '已至底部'
  85. }
  86. }else{
  87. this.isEmpty = true
  88. }
  89. }).catch(response =>{
  90. this.$util.msg(response.msg,2000)
  91. })
  92. },
  93. getOnReachBottomData(){
  94. this.pageNum+=1
  95. let params = {clubID:this.clubID,serviceProviderId:this.serviceProviderId,pageNum:this.pageNum,pageSize:this.pageSize};
  96. getSellerClubOrderList(params).then(response =>{
  97. let responseData = response.data
  98. if(responseData.results&&responseData.results.length > 0){
  99. this.hasNextPage = response.data.hasNextPage
  100. this.historyList = this.historyList.concat(responseData.results)
  101. this.pullFlag = false;// 防上拉暴滑
  102. setTimeout(()=>{this.pullFlag = true;},500)
  103. if(this.hasNextPage){
  104. this.pullUpOn = false
  105. this.nomoreText = '上拉显示更多'
  106. }else{
  107. this.pullUpOn = false
  108. this.loadding = false
  109. this.nomoreText = '已至底部'
  110. }
  111. }
  112. }).catch(response =>{
  113. this.$util.msg(response.msg,2000)
  114. })
  115. },
  116. orderPriceToFixed (n){
  117. let price ='';
  118. price = n.toFixed(2);
  119. return price
  120. },
  121. //订单状态文字和颜色
  122. orderStateExp (state){
  123. let stateText = '',
  124. stateTextObject={
  125. 0:'待确认',
  126. 4:'交易完成',
  127. 5:'订单完成',
  128. 6:'已关闭',
  129. 7:'交易全退',
  130. 77:'交易全退',
  131. 11:'待付款待发货',
  132. 12:'待付款部分发货',
  133. 13:'待付款已发货',
  134. 21:'部分付款待发货',
  135. 22:'部分付款部分发货',
  136. 23:'部分付款已发货',
  137. 31:'已付款待发货',
  138. 32:'已付款部分发货',
  139. 33:'已付款已发货',
  140. 111:'待付款待发货',
  141. }
  142. Object.keys(stateTextObject).forEach(key => {
  143. if(key == state){
  144. stateText = stateTextObject[key]
  145. }
  146. })
  147. return stateText;
  148. },
  149. orderDetiles(id){
  150. this.$api.navigateTo(`/market/pages/order/order-details?id=${id}`)
  151. }
  152. },
  153. onReachBottom() {
  154. if(this.hasNextPage){
  155. this.loadding = true
  156. this.pullUpOn = true
  157. this.getOnReachBottomData()
  158. }
  159. },
  160. onShow() {
  161. this.$api.getStorage().then((resolve) =>{
  162. console.log(resolve)
  163. this.serviceProviderId = resolve.serviceProviderID
  164. this.pageNum = 1;
  165. this.inithistoryList();
  166. })
  167. }
  168. }
  169. </script>
  170. <style lang='scss'>
  171. page {
  172. height: auto;
  173. }
  174. page,.container{
  175. /* padding-bottom: 120upx; */
  176. background: #F7F7F7;
  177. border-top: 1px solid #EBEBEB;
  178. }
  179. .container{
  180. position: relative;
  181. }
  182. .history-main{
  183. .list{
  184. display: flex;
  185. align-items: center;
  186. width: 702rpx;
  187. height: auto;
  188. padding: 24rpx;
  189. background: #FFFFFF;
  190. position: relative;
  191. border-bottom: 1px solid #EBEBEB;
  192. .list-left{
  193. flex: 8;
  194. .list-p{
  195. line-height: 58rpx;
  196. font-size: $font-size-26;
  197. color: $text-color;
  198. text-align: left;
  199. .txt{
  200. margin-left: 20rpx;
  201. }
  202. .tag{
  203. display: inline-block;
  204. width: 60rpx;
  205. height: 28rpx;
  206. line-height: 28rpx;
  207. font-size: $font-size-20;
  208. color: #FFFFFF;
  209. background: $btn-confirm;
  210. text-align: center;
  211. border-radius: 14rpx;
  212. margin-left: 20rpx;
  213. }
  214. }
  215. }
  216. .list-opea{
  217. flex: 2;
  218. color: #166CE1;
  219. .opea-p{
  220. line-height: 70rpx;
  221. font-size: $font-size-24;
  222. color: #E11616;
  223. text-align: right;
  224. }
  225. .opea-type-dell{
  226. width: 160rpx;
  227. height: 68rpx;
  228. line-height: 68rpx;
  229. font-size: $font-size-24;
  230. text-align: center;
  231. color: #FFFFFF;
  232. border-radius: 14rpx;
  233. background: #166CE1;
  234. margin-top: 24rpx;
  235. }
  236. }
  237. }
  238. }
  239. </style>