list.vue 7.5 KB

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