list.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="pagesCons">
  3. <view class="utabs">
  4. <u-tabs-swiper ref="uTabs" bar-width="160" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
  5. <view class="message">我的邀请码:{{yqcode}} <copyText :text="yqcode" 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" v-if="item.addrProvinceName||item.addrDetail">{{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. yqcode: ''
  71. }
  72. },
  73. onLoad(options) {
  74. const _this = this
  75. _this.tabList = this.$store.state.vuex_storeAuthState
  76. // 邀请码
  77. _this.yqcode = this.$store.state.vuex_userData.extInfo.dealer.dealerInviteCode
  78. // 获取数据
  79. _this.getRow(1)
  80. uni.$on("updateAuthState",function(){
  81. _this.getRow(1)
  82. })
  83. },
  84. onUnload() {
  85. uni.$off("updateAuthState")
  86. },
  87. methods:{
  88. // tabs通知swiper切换
  89. tabsChange(index) {
  90. this.swiperCurrent = index
  91. },
  92. swiperChange(event){
  93. this.action = 'swiperChange'
  94. this.status = 'loading'
  95. },
  96. // swiper-item左右移动,通知tabs的滑块跟随移动
  97. transition(e) {
  98. let dx = e.detail.dx
  99. this.$refs.uTabs.setDx(dx)
  100. },
  101. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  102. // swiper滑动结束,分别设置tabs和swiper的状态
  103. animationfinish(e) {
  104. let current = e.detail.current
  105. let isCurtab = this.current == current
  106. if(this.status!="nomore"){
  107. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab
  108. if(loadData){
  109. this.$refs.uTabs.setFinishCurrent(current)
  110. this.swiperCurrent = current
  111. this.current = current
  112. this.resetPage()
  113. }
  114. }
  115. },
  116. // scroll-view到底部加载更多
  117. onreachBottom() {
  118. this.action = 'onreachBottom'
  119. if(this.list.length < this.total){
  120. this.resetPage()
  121. }else{
  122. this.status = "nomore"
  123. }
  124. },
  125. // 查询列表
  126. getRow (pageNo) {
  127. if (pageNo) {
  128. this.pageNo = pageNo
  129. }
  130. let params = {
  131. pageNo: this.pageNo,
  132. pageSize: this.pageSize,
  133. auditStatus: this.tabList[this.current].code
  134. }
  135. this.status = "loading"
  136. xprhStoreApplyQueryPage(params).then(res => {
  137. if (res.status == 200) {
  138. if(this.pageNo>1){
  139. this.list = this.list.concat(res.data.list || [])
  140. }else{
  141. this.list = res.data.list || []
  142. }
  143. this.total = Number(res.data.count) || 0
  144. if(this.current == 0){
  145. this.tabList[0].count = this.total
  146. }
  147. } else {
  148. this.list = []
  149. this.total = 0
  150. this.noDataText = res.message
  151. }
  152. this.status = "loadmore"
  153. })
  154. },
  155. resetPage(){
  156. this.status = 'loading';
  157. // 上划分页
  158. if(this.action == 'onreachBottom'){
  159. this.pageNo += 1
  160. this.getRow()
  161. }
  162. // 左右切换tab
  163. if(this.action == 'swiperChange'){
  164. this.list = []
  165. this.getRow(1)
  166. }
  167. },
  168. // 详情
  169. toDetail(row){
  170. uni.navigateTo({
  171. url: "/pages/approveStore/detail?sn="+row.applySn
  172. })
  173. },
  174. // 审核
  175. handleAudit (row, type) {
  176. // 审核通过
  177. if (type == 1) {
  178. uni.navigateTo({
  179. url: "/pages/approveStore/authPass?sn="+row.applySn
  180. })
  181. } else {
  182. const _this = this
  183. clzConfirm({
  184. title: '提示',
  185. content: '确认审核不通过吗?',
  186. success: function(res) {
  187. if (res.confirm || res.index == 0) {
  188. xprhStoreApplyAudit({
  189. applySn: row.applySn,
  190. auditStatus: 'REFUSE'
  191. }).then(res => {
  192. if (res.status == 200) {
  193. _this.getRow(1)
  194. }
  195. })
  196. }
  197. }
  198. })
  199. }
  200. },
  201. }
  202. }
  203. </script>
  204. <style lang="scss">
  205. page {
  206. height: 100%;
  207. }
  208. .pagesCons{
  209. width: 100%;
  210. height: 100%;
  211. display: flex;
  212. flex-direction: column;
  213. .text-right {
  214. text-align: right;
  215. }
  216. .utabs{
  217. .message{
  218. padding: 0.5rem 1rem;
  219. background: #feffb9;
  220. margin-top: 0.5rem;
  221. }
  222. }
  223. .check-list{
  224. flex: 1;
  225. .swiper-item{
  226. width: 100%;
  227. height: 100%;
  228. overflow: hidden;
  229. .scroll-view {
  230. width: 100%;
  231. height: 100%;
  232. overflow: auto;
  233. }
  234. }
  235. }
  236. // 列表样式
  237. .check-order-list{
  238. background: #ffffff;
  239. margin: 25upx;
  240. border-radius: 25upx;
  241. box-shadow: 1px 1px 3px #EEEEEE;
  242. .check-row{
  243. display: flex;
  244. justify-content: space-between;
  245. >view{
  246. &:first-child{
  247. color: #999;
  248. font-size: 24rpx;
  249. width: 80%;
  250. }
  251. &:last-child{
  252. font-size: 24rpx;
  253. margin-top: 5rpx;
  254. }
  255. }
  256. border-bottom: 2rpx solid #eee;
  257. padding: 20rpx;
  258. }
  259. .check-col{
  260. padding: 20rpx;
  261. > view{
  262. padding: 3rpx 0;
  263. font-size: 26rpx;
  264. }
  265. .info{
  266. flex-grow: 1;
  267. padding: 0 10rpx 0 20rpx;
  268. }
  269. .btext{
  270. font-weight: bold;
  271. margin-bottom: 10rpx;
  272. }
  273. .addr{
  274. color: #999;
  275. margin-top: 6rpx;
  276. word-break: break-all;
  277. }
  278. }
  279. }
  280. }
  281. </style>