list.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view class="pagesCons">
  3. <view class="utabs">
  4. <u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
  5. <view class="message">我的邀请码:1A2B <copyText text="1A2B" label="邀请码"></copyText></view>
  6. </view>
  7. <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
  8. <swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
  9. <scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
  10. <view
  11. class="check-order-list"
  12. v-if="index==current"
  13. v-for="(item,sindex) in list"
  14. :key="item.id+'-'+sindex"
  15. >
  16. <view class="check-row">
  17. <view>{{item.applyTime}}</view>
  18. <view>
  19. <text>{{item.auditStatusDictValue}}</text>
  20. </view>
  21. </view>
  22. <view class="check-col">
  23. <view class="flex align_item" @click="toDetail(item)">
  24. <view class="imgs">
  25. <u-image :src="item.storeImage" :width="135" height="135" :border-radius="10"></u-image>
  26. </view>
  27. <view class="info">
  28. <view class="btext">{{item.contactPhone}} {{item.contactName}}</view>
  29. <view>{{item.storeName}}</view>
  30. <view class="addr">{{item.addrProvinceName +'-'+ item.addrCityName +'-'+ item.addrDistrictName +'-'+ item.addrDetail}}</view>
  31. </view>
  32. </view>
  33. <view style="width: 100%;text-align: right;" v-if="item.auditStatus == 'WAIT'">
  34. <u-button size="mini" hover-class="none" @click="handleAudit(item,0)" shape="circle">审核不通过</u-button>
  35. <u-button size="mini" type="success" @click="handleAudit(item,1)" :custom-style="customStyle" hover-class="none" shape="circle">审核通过</u-button>
  36. </view>
  37. </view>
  38. </view>
  39. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  40. <view v-if="index==current" style="padding: 20upx;">
  41. <u-loadmore :load-text="$config('loadText')" v-if="total>pageSize || status=='loading'" :status="status" />
  42. </view>
  43. </scroll-view>
  44. </swiper-item>
  45. </swiper>
  46. </view>
  47. </template>
  48. <script>
  49. import { xprhStoreApplyQueryPage, xprhStoreApplyAudit } from '@/api/approveStore'
  50. import { clzConfirm } from '@/libs/tools';
  51. import copyText from '@/pages/common/copyText.vue'
  52. export default {
  53. components: {copyText},
  54. data() {
  55. return {
  56. status: 'loadmore',
  57. noDataText: '暂无数据',
  58. tabList: [],
  59. current: 0,
  60. swiperCurrent: 0,
  61. pageNo: 1,
  62. pageSize: 10,
  63. list: [],
  64. total: 0,
  65. action:'swiperChange', // 操作类型,上划分页,或左右滑动
  66. customStyle: {
  67. background: this.$config('primaryColor'),
  68. marginLeft: '20rpx'
  69. },
  70. }
  71. },
  72. onLoad(options) {
  73. const _this = this
  74. _this.tabList = this.$store.state.vuex_storeAuthState
  75. _this.getRow()
  76. uni.$on("updateAuthState",function(){
  77. _this.getRow(1)
  78. })
  79. },
  80. onUnload() {
  81. uni.$off("updateAuthState")
  82. },
  83. methods:{
  84. // tabs通知swiper切换
  85. tabsChange(index) {
  86. this.swiperCurrent = index
  87. },
  88. swiperChange(event){
  89. this.action = 'swiperChange'
  90. this.status = 'loading'
  91. },
  92. // swiper-item左右移动,通知tabs的滑块跟随移动
  93. transition(e) {
  94. let dx = e.detail.dx
  95. this.$refs.uTabs.setDx(dx)
  96. },
  97. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  98. // swiper滑动结束,分别设置tabs和swiper的状态
  99. animationfinish(e) {
  100. let current = e.detail.current
  101. let isCurtab = this.current == current
  102. if(this.status!="nomore"){
  103. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab
  104. if(loadData){
  105. this.$refs.uTabs.setFinishCurrent(current)
  106. this.swiperCurrent = current
  107. this.current = current
  108. this.resetPage()
  109. }
  110. }
  111. },
  112. // scroll-view到底部加载更多
  113. onreachBottom() {
  114. this.action = 'onreachBottom'
  115. if(this.list.length < this.total){
  116. this.resetPage()
  117. }else{
  118. this.status = "nomore"
  119. }
  120. },
  121. // 查询列表
  122. getRow (pageNo) {
  123. if (pageNo) {
  124. this.pageNo = pageNo
  125. }
  126. let params = {
  127. pageNo: this.pageNo,
  128. pageSize: this.pageSize,
  129. auditStatus: this.tabList[this.current].code
  130. }
  131. this.status = "loading"
  132. xprhStoreApplyQueryPage(params).then(res => {
  133. if (res.status == 200) {
  134. if(this.pageNo>1){
  135. this.list = this.list.concat(res.data.list || [])
  136. }else{
  137. this.list = res.data.list || []
  138. }
  139. this.total = res.data.count || 0
  140. } else {
  141. this.list = []
  142. this.total = 0
  143. this.noDataText = res.message
  144. }
  145. this.status = "loadmore"
  146. })
  147. },
  148. resetPage(){
  149. this.status = 'loading';
  150. // 上划分页
  151. if(this.action == 'onreachBottom'){
  152. this.pageNo += 1
  153. this.getRow()
  154. }
  155. // 左右切换tab
  156. if(this.action == 'swiperChange'){
  157. this.list = []
  158. this.getRow(1)
  159. }
  160. },
  161. // 详情
  162. toDetail(row){
  163. uni.navigateTo({
  164. url: "/pages/approveStore/detail?sn="+row.applySn
  165. })
  166. },
  167. // 审核
  168. handleAudit (row, type) {
  169. // 审核通过
  170. if (type == 1) {
  171. uni.navigateTo({
  172. url: "/pages/approveStore/authPass?sn="+row.applySn
  173. })
  174. } else {
  175. const _this = this
  176. clzConfirm({
  177. title: '提示',
  178. content: '确认审核不通过吗?',
  179. success: function(res) {
  180. if (res.confirm || res.index == 0) {
  181. xprhStoreApplyAudit({
  182. applySn: row.applySn,
  183. auditStatus: 'REFUSE'
  184. }).then(res => {
  185. if (res.status == 200) {
  186. _this.getRow(1)
  187. }
  188. })
  189. }
  190. }
  191. })
  192. }
  193. },
  194. }
  195. }
  196. </script>
  197. <style lang="scss">
  198. page {
  199. height: 100%;
  200. }
  201. .pagesCons{
  202. width: 100%;
  203. height: 100%;
  204. display: flex;
  205. flex-direction: column;
  206. .text-right {
  207. text-align: right;
  208. }
  209. .utabs{
  210. .message{
  211. padding: 0.5rem 1rem;
  212. background: #feffb9;
  213. margin-top: 0.5rem;
  214. }
  215. }
  216. .check-list{
  217. flex: 1;
  218. .swiper-item{
  219. width: 100%;
  220. height: 100%;
  221. overflow: hidden;
  222. .scroll-view {
  223. width: 100%;
  224. height: 100%;
  225. overflow: auto;
  226. }
  227. }
  228. }
  229. // 列表样式
  230. .check-order-list{
  231. background: #ffffff;
  232. margin: 25upx;
  233. border-radius: 25upx;
  234. box-shadow: 1px 1px 3px #EEEEEE;
  235. .check-row{
  236. display: flex;
  237. justify-content: space-between;
  238. >view{
  239. &:first-child{
  240. color: #999;
  241. font-size: 24rpx;
  242. width: 80%;
  243. }
  244. &:last-child{
  245. font-size: 24rpx;
  246. margin-top: 5rpx;
  247. }
  248. }
  249. border-bottom: 2rpx solid #eee;
  250. padding: 20rpx;
  251. }
  252. .check-col{
  253. padding: 20rpx;
  254. > view{
  255. padding: 3rpx 0;
  256. font-size: 26rpx;
  257. }
  258. .info{
  259. flex-grow: 1;
  260. padding: 0 10rpx 0 20rpx;
  261. }
  262. .btext{
  263. font-weight: bold;
  264. margin-bottom: 10rpx;
  265. }
  266. .addr{
  267. color: #999;
  268. margin-top: 6rpx;
  269. word-break: break-all;
  270. }
  271. }
  272. }
  273. }
  274. </style>