list.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <view class="container">
  3. <u-toast ref="uToast"/>
  4. <u-modal cancel-text="重置" cancel-color="#000000" @cancel="filterReset" :show-cancel-button="true" @confirm="filterConfirm" title="筛选" :mask-close-able="true" v-model="filterShow" >
  5. <view class="slot-content" style="margin: 20rpx;">
  6. <u-form label-width="150" ref="uForm">
  7. <u-form-item label="员工姓名"><u-input v-model="realName" /></u-form-item>
  8. <u-form-item :border-bottom="false" label="手机号"><u-input v-model="phone" type="number" /></u-form-item>
  9. </u-form>
  10. </view>
  11. </u-modal>
  12. <u-modal :show-cancel-button="true" @confirm="opinionConfirm" title="审核意见" :mask-close-able="true" v-model="opinionShow" >
  13. <view class="slot-content" style="margin: 20rpx;">
  14. <u-form label-width="150" ref="uForm">
  15. <u-form-item :border-bottom="false"><u-input height="150" placeholder="请输入审核意见(选填)" v-model="opinion" /></u-form-item>
  16. </u-form>
  17. </view>
  18. </u-modal>
  19. <view class="tabs flex flex-direction">
  20. <view class="flex">
  21. <scroll-view scroll-x class="bg-white nav" style="width: 90%;">
  22. <view class="flex text-center">
  23. <view class="cu-item flex-sub" :class="index==current?'text-blue text-xl text-bold ':'text-lg'" v-for="(item,index) in tabs" :key="index" @tap="tabChange(index)" >
  24. {{item.name}}
  25. </view>
  26. </view>
  27. </scroll-view>
  28. <view class="flex justify-center align-center" @click="show">
  29. <text class="cuIcon-filter " style="font-size: 40rpx;"></text>
  30. <u-badge size="mini" type="error" :count="filterCount"></u-badge>
  31. </view>
  32. </view>
  33. </view>
  34. <view style="height: 100%;">
  35. <swiper style="height: 100%;" :current="current" @change="swiperChange"
  36. @animationfinish="animationfinish">
  37. <swiper-item v-for="(item, index) in tabs" :key="index">
  38. <scroll-view scroll-y style="height: 100%;">
  39. <item @showOpinion="showOpinion" ref="mescrollItem" :opinion="opinion" :realName="realName" :phone="phone" :refresh="refresh" :i="index" :item="item" :type="current"></item>
  40. </scroll-view>
  41. </swiper-item>
  42. </swiper>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import item from "./item.vue"
  48. export default {
  49. components: {
  50. item
  51. },
  52. data() {
  53. return {
  54. // 审核不通过的审核意见
  55. opinion:'',
  56. // 显示审核不通过对话框
  57. opinionShow:false,
  58. // 审核不通过的对象
  59. failItem:{},
  60. filterCount:0,
  61. filterShow:false,
  62. realName:'',
  63. phone:'',
  64. current: 0,
  65. swiperCurrent:0,
  66. tabs: [
  67. {
  68. name: '全部',
  69. value:-1
  70. },
  71. {
  72. name: '待审核',
  73. value:0
  74. },
  75. {
  76. name: '已通过',
  77. value:1
  78. },
  79. {
  80. name:'未通过',
  81. value:2
  82. }
  83. ],
  84. }
  85. },
  86. onShow(){
  87. let pages = getCurrentPages(); //获取所有页面栈实例列表
  88. let currPage = pages[ pages.length - 1]; //当前页页面实例
  89. if (currPage.data.flag==true) {
  90. this.realName=''
  91. this.phone=''
  92. this.refreshMescroll()
  93. }
  94. },
  95. onLoad() {
  96. },
  97. methods:{
  98. showOpinion(item){
  99. this.opinionShow=true
  100. this.failItem=item
  101. },
  102. /**
  103. * 确定审核不通过回调
  104. */
  105. opinionConfirm(){
  106. this.submitFailAudit()
  107. },
  108. /**
  109. * 审核不通过
  110. * @param {Object}
  111. */
  112. submitFailAudit(){
  113. let item=this.$u.deepClone(this.failItem)
  114. let that=this
  115. item.examine=2
  116. item.opinion=that.opinion
  117. item.auditTime=this.$createDateTime()
  118. that.$api.enterprisestaff.submit(item).then(res=>{
  119. if (res.success==true) {
  120. this.$showToast(res.msg)
  121. let msgData={
  122. openId:item.openId,
  123. content:"审核不通过",
  124. remarks:that.opinion || '审核不通过',
  125. enterpriseName:item.enterpriseName
  126. }
  127. that.send(msgData)
  128. that.$nextTick(() => {
  129. that.refreshMescroll()
  130. })
  131. }
  132. })
  133. },
  134. /**
  135. * 发送信息
  136. */
  137. async send(msgData){
  138. let tokenData={
  139. grantType:this.$api.wxData.subscribe_grant_type,
  140. appId:this.$api.wxData.appId,
  141. secret:this.$api.wxData.secret
  142. }
  143. let res=await this.$api.wxApi.getAccessToken(tokenData)
  144. let token=JSON.parse(res.data).access_token
  145. let subscribeData={
  146. accessToken:token,
  147. touser:msgData.openId,
  148. lang:"zh_CN",
  149. page:'/pages/index/index',
  150. miniprogramState:this.$miniprogramState.FORMAL,
  151. templateId: this.$tmplIds[0],
  152. "data": {
  153. "thing13": {
  154. "value": msgData.enterpriseName
  155. },
  156. "thing9":{
  157. "value": "员工认证信息审核"
  158. },
  159. "phrase2": {
  160. "value": msgData.content
  161. },
  162. "thing3": {
  163. "value": msgData.remarks
  164. },
  165. }
  166. }
  167. this.$api.wxApi.subscribe(subscribeData).then(res=>{
  168. console.log(res);
  169. }).catch(err=>{
  170. console.error(err);
  171. })
  172. },
  173. /**
  174. * 筛选显示
  175. */
  176. show(){
  177. this.filterShow=true
  178. },
  179. /**
  180. * 筛选
  181. */
  182. filterConfirm(){
  183. this.refreshMescroll()
  184. let n=0
  185. if (!this.$isEmpty(this.realName)) {
  186. n++
  187. }
  188. if (!this.$isEmpty(this.phone)) {
  189. n++
  190. }
  191. this.filterCount=n
  192. },
  193. /**
  194. * 重置筛选项
  195. */
  196. filterReset(){
  197. this.filterCount=0
  198. this.realName=''
  199. this.phone=''
  200. this.$nextTick(() => {
  201. this.refreshMescroll()
  202. })
  203. },
  204. /**
  205. * 刷新列表
  206. */
  207. refreshMescroll(){
  208. let curMescroll = this.getMescroll(this.current)
  209. curMescroll && curMescroll.resetUpScroll()
  210. },
  211. /**
  212. * 获取Mescroll对象
  213. * @param {Object} i
  214. */
  215. getMescroll(i){
  216. let mescrollItems = this.$refs.mescrollItem;
  217. if(mescrollItems){
  218. let item = mescrollItems[i]
  219. if(item) return item.mescroll
  220. }
  221. return null
  222. },
  223. tabChange(index) {
  224. this.current = index
  225. },
  226. swiperChange(e) {
  227. uni.pageScrollTo({
  228. scrollTop: 0,
  229. duration: 0
  230. });
  231. this.current = e.detail.current
  232. },
  233. animationfinish({detail: { current }}) {
  234. this.swiperCurrent = current;
  235. this.current = current;
  236. },
  237. }
  238. }
  239. </script>
  240. <style lang="scss" scoped>
  241. .text-blue{
  242. color: #59a5f0;
  243. }
  244. .text-xl{
  245. font-size: 34rpx;
  246. }
  247. .container {
  248. height: calc(100vh);
  249. background-color: #F6F6F6;
  250. padding: 78rpx 0rpx 0rpx;
  251. .tabs {
  252. position: fixed;
  253. top: -10rpx;
  254. left: 0;
  255. width: 100%;
  256. background-color: #FFFFFF;
  257. box-sizing: border-box;
  258. z-index: 3;
  259. }
  260. }
  261. </style>