list.vue 7.7 KB

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