item1.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <MeScroll :up="up" :down="down" @up="upFn" :fixed="false" @down="downFn" @init="initMeScroll">
  3. <u-modal :show-cancel-button="true" @cancel="filterReset" cancel-text="重置" cancel-color="#000000" @confirm="filterConfirm" title="筛选" :mask-close-able="true" v-model="filterShow" >
  4. <view class="slot-content" style="margin: 20rpx;">
  5. <u-form label-width="150" ref="uForm">
  6. <u-form-item label="姓名"><u-input v-model="realName" /></u-form-item>
  7. <u-form-item :border-bottom="false" label="手机号"><u-input type="number" v-model="phone" /></u-form-item>
  8. </u-form>
  9. </view>
  10. </u-modal>
  11. <card @pass="pass" @fail="fail" :list="list" ></card>
  12. </MeScroll>
  13. </template>
  14. <script>
  15. import MeScroll from '@/components/mescroll-body/mescroll-uni.vue'
  16. import card from './card.vue'
  17. var app=getApp()
  18. export default {
  19. components:{
  20. MeScroll,card
  21. },
  22. props: {
  23. refresh:Boolean,
  24. type: Number,
  25. i: Number,
  26. fireType: Number,
  27. item:Object
  28. },
  29. data() {
  30. return {
  31. realName:'',
  32. phone:'',
  33. filterShow:false,
  34. //审核不通过时展示
  35. modelShow:false,
  36. //审核不通过的原因
  37. opinion:'',
  38. dataDetail:{},
  39. //所属公司
  40. enterpriseId:'',
  41. //登录类型
  42. loginType:'',
  43. //园区id
  44. agencyId:'',
  45. isInit: false, // 是否初始化
  46. list: [], // 列表数据
  47. mescroll: null, // mescroll 对象
  48. // 上拉配置参数
  49. up: {
  50. noMoreSize: 2,
  51. auto: true,
  52. page: {
  53. page: 0,
  54. size: 10
  55. }
  56. },
  57. // 下拉配置参数
  58. down: {
  59. use: true,
  60. auto: false
  61. }
  62. }
  63. },
  64. created() {
  65. this.enterpriseId= this.$cache.get('enterpriseId')
  66. this.loginType=this.$cache.get('loginType')
  67. this.agencyId=this.$cache.get('agencyId')
  68. },
  69. watch:{
  70. refresh() {
  71. console.log("我要刷新了");
  72. this.mescroll.resetUpScroll()
  73. },
  74. type(val) {
  75. if(!this.isInit && val === this.i) {
  76. this.mescroll.resetUpScroll()
  77. }
  78. }
  79. },
  80. mounted() {
  81. if(!this.isInit && this.i === 0) {
  82. this.mescroll.resetUpScroll()
  83. }
  84. },
  85. methods: {
  86. show(){
  87. this.filterShow=!this.filterShow
  88. },
  89. filterConfirm(){
  90. this.mescroll.resetUpScroll()
  91. },
  92. filterReset(){
  93. this.realName=''
  94. this.phone=''
  95. this.mescroll.resetUpScroll()
  96. },
  97. /**
  98. * 通过审核
  99. */
  100. pass(item){
  101. let that=this
  102. this.$showModel("确定审核通过该员工信息吗?").then(res=>{
  103. item.examine=1
  104. item.auditTime=this.$createDateTime()
  105. this.$api.enterprisestaff.submit(item).then(res=>{
  106. that.$u.toast(res.msg)
  107. let msgData={
  108. openId:item.openId,
  109. content:"审核已通过",
  110. remarks:"已审核",
  111. enterpriseName:item.enterpriseName
  112. }
  113. that.send(msgData)
  114. that.mescroll.resetUpScroll()
  115. })
  116. })
  117. },
  118. /**
  119. * 审核不通过
  120. * @param {Object}
  121. */
  122. submitFailAudit(){
  123. let item=this.dataDetail
  124. let that=this
  125. item.examine=2
  126. item.opinion=that.opinion
  127. item.auditTime=this.$createDateTime()
  128. this.$api.enterprisestaff.submit(item).then(res=>{
  129. let msgData={
  130. openId:item.openId,
  131. content:"审核不通过",
  132. remarks:that.opinion || '审核不通过',
  133. enterpriseName:item.enterpriseName
  134. }
  135. that.send(msgData)
  136. that.$u.toast(res.msg)
  137. that.mescroll.resetUpScroll()
  138. })
  139. },
  140. /**
  141. * 显示审核不通过的意见框
  142. * @param {Object} item
  143. */
  144. fail(item){
  145. this.dataDetail=item
  146. this.modelShow=true
  147. },
  148. async send(msgData){
  149. let tokenData={
  150. grantType:this.$api.wxData.subscribe_grant_type,
  151. appId:this.$api.wxData.appId,
  152. secret:this.$api.wxData.secret
  153. }
  154. let res=await this.$api.wxApi.getAccessToken(tokenData)
  155. let token=JSON.parse(res.data).access_token
  156. let subscribeData={
  157. accessToken:token,
  158. touser:msgData.openId,
  159. lang:"zh_CN",
  160. page:'/pages/index/index',
  161. miniprogramState:this.$miniprogramState.FORMAL,
  162. templateId: this.$tmplIds[0],
  163. "data": {
  164. "thing13": {
  165. "value": msgData.enterpriseName
  166. },
  167. "thing9":{
  168. "value": "员工认证信息审核"
  169. },
  170. "phrase2": {
  171. "value": msgData.content
  172. },
  173. "thing3": {
  174. "value": msgData.remarks
  175. },
  176. }
  177. }
  178. this.$api.wxApi.subscribe(subscribeData).then(res=>{
  179. console.log(res);
  180. }).catch(err=>{
  181. console.error(err);
  182. })
  183. },
  184. /**
  185. * @param {Object} mescroll 初始化组件
  186. */
  187. initMeScroll(mescroll) {
  188. this.mescroll = mescroll
  189. },
  190. /**
  191. * @param {Object} mescroll 上拉回调
  192. */
  193. upFn(mescroll) {
  194. let that=this
  195. let obj={
  196. realName:this.realName,
  197. phone:this.phone,
  198. current:mescroll.num,
  199. size:mescroll.size
  200. }
  201. if (this.loginType==this.$loginType.ENTERPRISE) {
  202. //企业登录
  203. obj.enterpriseId=this.enterpriseId
  204. }else if(this.loginType==this.$loginType.AGENCY){
  205. //园区管理员登陆
  206. obj.agencyId=this.agencyId
  207. }
  208. if (this.item.value!=-1) {
  209. //不是查询全部就传examine
  210. obj.examine=this.item.value
  211. }
  212. try{
  213. this.$api.enterprisestaff.page(obj).then(res=>{
  214. let data=res.data.records
  215. let length=data.length
  216. let total=res.data.total
  217. mescroll.endBySize(length, total);
  218. if(mescroll.num == 1) that.list = []; //如果是第一页需手动制空列表
  219. that.list=that.list.concat(data); //追加新数据
  220. })
  221. }catch(e){
  222. mescroll.endErr();
  223. }
  224. },
  225. /**
  226. * 下拉回调
  227. * */
  228. downFn(mescroll) {
  229. setTimeout(()=>{
  230. this.phone=''
  231. this.realName=''
  232. this.list=[]
  233. this.mescroll.resetUpScroll()
  234. },1500)
  235. },
  236. }
  237. }
  238. </script>
  239. <style lang="scss" scoped>
  240. view{
  241. box-sizing: border-box;
  242. }
  243. </style>