order-history.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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.number}}</text><text v-if="item.flag == 1" class="tag">协销</text></view>
  12. <view class="list-p">总金额:<text class="txt">¥{{item.money}}</text></view>
  13. <view class="list-p">数量(赠):<text class="txt">{{item.num}}</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.historyID)">
  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 { queryhistoryList, deletehistory , updateCode } from "@/api/operator.js"
  36. export default {
  37. components:{
  38. tuiLoadmore,
  39. tuiNomore,
  40. },
  41. data() {
  42. return {
  43. historyID:'',
  44. historyName:'',
  45. historyImage:'',
  46. linkman:'',
  47. historyMobile:'',
  48. isEmpty:false,
  49. nomoreText: '上拉显示更多',
  50. userID:'',
  51. pageNum:1,
  52. pageSize:10,
  53. hasNextPage:false,
  54. loadding: false,
  55. pullUpOn: true,
  56. pullFlag: true,
  57. allowDataStatus:true,
  58. wrapperHeight:'100%',
  59. scrollHeight:'',
  60. deleteAddressId:'',
  61. currPage:'',//当前页面
  62. prevPage:'',//上一个页面
  63. tabCurrentIndex:0,
  64. historyList:[
  65. {
  66. number:'CM65656566556566',
  67. money:'23000.00',
  68. num:'1',
  69. status:4,
  70. historyID:1,
  71. flag:0
  72. },
  73. {
  74. number:'CM65656566556566',
  75. money:'23000.00',
  76. num:'1',
  77. status:5,
  78. historyID:1,
  79. flag:0
  80. },
  81. {
  82. number:'CM65656566556566',
  83. money:'23000.00',
  84. num:'1',
  85. status:6,
  86. historyID:1,
  87. flag:1
  88. },
  89. ],
  90. }
  91. },
  92. onLoad(option){
  93. console.log(option)
  94. },
  95. methods: {
  96. inithistoryList(){
  97. let params = {historyID:this.historyID,pageNum:1,pageSize:this.pageSize,linkName:this.linkman,mobile:this.historyMobile}
  98. queryhistoryList(params).then(response =>{
  99. let responseData = response.data
  100. if(responseData.results&&responseData.results.length > 0){
  101. this.isEmpty = false
  102. this.hasNextPage = response.data.hasNextPage
  103. this.historyList =responseData.results
  104. this.pullFlag = false;
  105. setTimeout(()=>{this.pullFlag = true;},500)
  106. if(this.hasNextPage){
  107. this.pullUpOn = false
  108. this.nomoreText = '上拉显示更多'
  109. }else{
  110. this.pullUpOn = true
  111. this.loadding = false
  112. this.nomoreText = '已至底部'
  113. }
  114. }else{
  115. this.isEmpty = true
  116. }
  117. }).catch(response =>{
  118. this.$util.msg(response.msg,2000)
  119. })
  120. },
  121. getOnReachBottomData(){
  122. this.pageNum+=1
  123. let params = {pageNum:this.pageNum,pageSize:this.pageSize,linkName:this.linkman,mobile:this.historyMobile}
  124. queryhistoryList(params).then(response =>{
  125. let responseData = response.data
  126. if(responseData.results&&responseData.results.length > 0){
  127. this.hasNextPage = response.data.hasNextPage
  128. this.historyList = this.historyList.concat(responseData.results)
  129. this.pullFlag = false;// 防上拉暴滑
  130. setTimeout(()=>{this.pullFlag = true;},500)
  131. if(this.hasNextPage){
  132. this.pullUpOn = false
  133. this.nomoreText = '上拉显示更多'
  134. }else{
  135. this.pullUpOn = false
  136. this.loadding = false
  137. this.nomoreText = '已至底部'
  138. }
  139. }
  140. }).catch(response =>{
  141. this.$util.msg(response.msg,2000)
  142. })
  143. },
  144. //订单状态文字和颜色
  145. orderStateExp (state){
  146. let stateText = '',
  147. stateTextObject={
  148. 0:'待确认',
  149. 4:'交易完成',
  150. 5:'订单完成',
  151. 6:'已关闭',
  152. 7:'交易全退',
  153. 77:'交易全退',
  154. 11:'待付款待发货',
  155. 12:'待付款部分发货',
  156. 13:'待付款已发货',
  157. 21:'部分付款待发货',
  158. 22:'部分付款部分发货',
  159. 23:'部分付款已发货',
  160. 31:'已付款待发货',
  161. 32:'已付款部分发货',
  162. 33:'已付款已发货',
  163. 111:'待付款待发货',
  164. }
  165. Object.keys(stateTextObject).forEach(key => {
  166. if(key == state){
  167. stateText = stateTextObject[key]
  168. }
  169. })
  170. return stateText;
  171. },
  172. orderDetiles(id){
  173. this.$api.navigateTo(`/market/pages/order/order-details?id=${id}`)
  174. }
  175. },
  176. onReachBottom() {
  177. if(this.hasNextPage){
  178. this.loadding = true
  179. this.pullUpOn = true
  180. this.getOnReachBottomData()
  181. }
  182. },
  183. onShow() {
  184. this.$api.getCommonStorage('historyInfo').then(response =>{
  185. console.log(response)
  186. this.historyID = response.historyID
  187. this.historyName = response.name
  188. this.historyImage = response.image
  189. this.pageNum = 1;
  190. // this.inithistoryList();
  191. })
  192. }
  193. }
  194. </script>
  195. <style lang='scss'>
  196. page {
  197. height: auto;
  198. }
  199. page,.container{
  200. /* padding-bottom: 120upx; */
  201. background: #F7F7F7;
  202. border-top: 1px solid #EBEBEB;
  203. }
  204. .container{
  205. position: relative;
  206. }
  207. .history-main{
  208. .list{
  209. display: flex;
  210. align-items: center;
  211. width: 702rpx;
  212. height: auto;
  213. padding: 24rpx;
  214. background: #FFFFFF;
  215. position: relative;
  216. border-bottom: 1px solid #EBEBEB;
  217. .list-left{
  218. flex: 8;
  219. .list-p{
  220. line-height: 58rpx;
  221. font-size: $font-size-26;
  222. color: $text-color;
  223. text-align: left;
  224. .txt{
  225. margin-left: 20rpx;
  226. }
  227. .tag{
  228. display: inline-block;
  229. width: 60rpx;
  230. height: 28rpx;
  231. line-height: 28rpx;
  232. font-size: $font-size-20;
  233. color: #FFFFFF;
  234. background: $btn-confirm;
  235. text-align: center;
  236. }
  237. }
  238. }
  239. .list-opea{
  240. flex: 2;
  241. color: #166CE1;
  242. .opea-p{
  243. line-height: 70rpx;
  244. font-size: $font-size-24;
  245. color: #E11616;
  246. text-align: right;
  247. }
  248. .opea-type-dell{
  249. width: 160rpx;
  250. height: 68rpx;
  251. line-height: 68rpx;
  252. font-size: $font-size-24;
  253. text-align: center;
  254. color: #FFFFFF;
  255. border-radius: 14rpx;
  256. background: #166CE1;
  257. margin-top: 24rpx;
  258. }
  259. }
  260. }
  261. }
  262. </style>