list.vue 7.9 KB

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