index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <view class="">
  3. <!-- <view class="search">
  4. <uv-search placeholder="请输入搜索内容" v-model="keyword"></uv-search>
  5. </view> -->
  6. <view class="">
  7. <!-- 使用z-paging-swiper为根节点可以免计算高度 -->
  8. <z-paging-swiper>
  9. <!-- 需要固定在顶部不滚动的view放在slot="top"的view中 -->
  10. <!-- 注意!此处的z-tabs为独立的组件,可替换为第三方的tabs,若需要使用z-tabs,请在插件市场搜索z-tabs并引入,否则会报插件找不到的错误 -->
  11. <template #top>
  12. <z-tabs ref="tabs" :list="tabList" :current="current" @change="tabsChange" />
  13. </template>
  14. <!-- swiper必须设置height:100%,因为swiper有默认的高度,只有设置高度100%才可以铺满页面 -->
  15. <swiper class="swiper" :current="current" @transition="swiperTransition"
  16. @animationfinish="swiperAnimationfinish">
  17. <swiper-item class="swiper-item" v-for="(item, index) in tabList" :key="index">
  18. <!-- 这里的swiper-list-item为demo中为演示用定义的组件,列表及分页代码在swiper-list-item组件内 -->
  19. <!-- 请注意,swiper-list-item非z-paging内置组件,在自己的项目中必须自己创建,若未创建则会报组件不存在的错误 -->
  20. <swiper-list-item :tabIndex="index" :currentIndex="current">
  21. <block v-if="index==0">
  22. <view class="" style="overflow-y: scroll !important;height: 94vh;">
  23. <block v-if="data.some(item => item.status==0 || item.status==2 || item.status==6)">
  24. <block v-for="(items, indexs) in data" :key="indexs">
  25. <block v-if="items.status==0 || items.status==2 || items.status==6">
  26. <view class="jie_card" @click="detail(items.id)">
  27. <view class="jie_card_title">
  28. <text class="jie_card_title_text">借单号:{{items.encoding}}</text>
  29. <text class="jie_tags" v-if="items.purpose==1">教学借单</text>
  30. <text class="jie_tags jie_tags2" v-if="items.purpose==0">科研借单</text>
  31. </view>
  32. <uv-line></uv-line>
  33. <view class="jie_contend">
  34. <view class="jie_contend_text">
  35. <text class="jie_contend_text1">借取人:</text>
  36. <text class="jie_contend_text2">{{items.username}}</text>
  37. </view>
  38. <view class="jie_contend_text">
  39. <text class="jie_contend_text1">联系电话:</text>
  40. <text class="jie_contend_text2">{{items.mobile}}</text>
  41. </view>
  42. <view class="jie_contend_text">
  43. <text class="jie_contend_text1">申请时间:</text>
  44. <text class="jie_contend_text2">{{items.create_time}}</text>
  45. </view>
  46. </view>
  47. <view class="jie_card_ztai"
  48. v-if="items.status==6">
  49. 学院审批</view>
  50. <view class="jie_card_ztai" v-if="items.status==0">待审批
  51. </view>
  52. <view class="jie_card_ztai jie_card_ztai2" v-if="items.status==2 ">待使用
  53. </view>
  54. </view>
  55. </block>
  56. </block>
  57. </block>
  58. <view class="" v-else>
  59. <uv-empty text="暂无数据" icon="https://cdn.uviewui.com/uview/empty/list.png"></uv-empty>
  60. </view>
  61. <view style="width: 100%; height: 5vh;">
  62. </view>
  63. </view>
  64. </block>
  65. <block v-else-if="index==1">
  66. <view class="" style="overflow-y: scroll !important;height: 90vh;">
  67. <block v-if="data.some(item => item.status === 3 || item.status === 5)">
  68. <block v-for="(items, indexs) in data" :key="indexs">
  69. <block v-if="items.status==3 || items.status==5">
  70. <view class="jie_card" @click="detail(items.id)">
  71. <view class="jie_card_title">
  72. <text class="jie_card_title_text">借单号:{{items.encoding}}</text>
  73. <text class="jie_tags" v-if="items.purpose==1">教学借单</text>
  74. <text class="jie_tags jie_tags2" v-if="items.purpose==0">科研借单</text>
  75. </view>
  76. <uv-line></uv-line>
  77. <view class="jie_contend">
  78. <view class="jie_contend_text">
  79. <text class="jie_contend_text1">借取人:</text>
  80. <text class="jie_contend_text2">{{items.username}}</text>
  81. </view>
  82. <view class="jie_contend_text">
  83. <text class="jie_contend_text1">联系电话:</text>
  84. <text class="jie_contend_text2">{{items.mobile}}</text>
  85. </view>
  86. <view class="jie_contend_text">
  87. <text class="jie_contend_text1">申请时间:</text>
  88. <text class="jie_contend_text2">{{items.create_time}}</text>
  89. </view>
  90. </view>
  91. <view class="jie_card_ztai" v-if="items.status==5">已逾期</view>
  92. <view class="jie_card_ztai jie_card_ztai2" v-if="items.status==3">使用中</view>
  93. </view>
  94. </block>
  95. </block>
  96. </block>
  97. <view class="" v-else>
  98. <uv-empty text="暂无数据" icon="https://cdn.uviewui.com/uview/empty/list.png"></uv-empty>
  99. </view>
  100. <view style="width: 100%; height: 5vh;">
  101. </view>
  102. </view>
  103. </block>
  104. <block v-else-if="index==2">
  105. <view class="" style="overflow-y: scroll !important;height: 90vh;">
  106. <block v-if="data.some(item => item.status==1 || item.status==4 || item.status==7)">
  107. <block v-for="(items, indexs) in data" :key="indexs">
  108. <block v-if="items.status==1 || items.status==4 || items.status==7 ">
  109. <view class="jie_card" @click="detail(items.id)">
  110. <view class="jie_card_title">
  111. <text class="jie_card_title_text">借单号:{{items.encoding}}</text>
  112. <text class="jie_tags" v-if="items.purpose==1">教学借单</text>
  113. <text class="jie_tags jie_tags2" v-if="items.purpose==0">科研借单</text>
  114. </view>
  115. <uv-line></uv-line>
  116. <view class="jie_contend">
  117. <view class="jie_contend_text">
  118. <text class="jie_contend_text1">借取人:</text>
  119. <text class="jie_contend_text2">{{items.username}}</text>
  120. </view>
  121. <view class="jie_contend_text">
  122. <text class="jie_contend_text1">联系电话:</text>
  123. <text class="jie_contend_text2">{{items.mobile}}</text>
  124. </view>
  125. <view class="jie_contend_text">
  126. <text class="jie_contend_text1">申请时间:</text>
  127. <text class="jie_contend_text2">{{items.create_time}}</text>
  128. </view>
  129. </view>
  130. <view class="jie_card_ztai" v-if="items.status==1">已驳回</view>
  131. <view class="jie_card_ztai" v-if="items.status==7">领导驳回</view>
  132. <view class="jie_card_ztai jie_card_ztai2" v-if="items.status==4">已归还</view>
  133. </view>
  134. </block>
  135. </block>
  136. </block>
  137. <view class="" v-else>
  138. <uv-empty text="暂无数据" icon="https://cdn.uviewui.com/uview/empty/list.png"></uv-empty>
  139. </view>
  140. <view style="width: 100%; height: 5vh;">
  141. </view>
  142. </view>
  143. </block>
  144. </swiper-list-item>
  145. </swiper-item>
  146. </swiper>
  147. </z-paging-swiper>
  148. </view>
  149. </view>
  150. <view class="">
  151. <uni-popup ref="wxpopup" type="bottom">
  152. <view class="tihuan_box" style="height: 650rpx;">
  153. <view class="" style="text-align: center; margin-bottom: 20rpx; font-size: 35rpx; font-weight: bold;margin-bottom: 30rpx;">
  154. 请长按识别二维码关注公众号
  155. <br />
  156. 方便信息及时通知
  157. </view>
  158. <view class="" style="width: 80%; margin: 0 auto;">
  159. <image :show-menu-by-longpress="true" src="../../static/img/erweima.jpg" mode="widthFix" style="width: 100%;"></image>
  160. </view>
  161. </view>
  162. </uni-popup>
  163. </view>
  164. <view class="yiqijie" @click="application">
  165. <image src="../../static/img/sqi.png" mode="widthFix" style="width: 50rpx;margin-bottom: -12rpx;"></image>
  166. 仪器借用
  167. </view>
  168. <!-- <web-view v-if="stuts" src="http://yxy.glut.cc/api/xmwechat.Offiaccount/oauth?server=1"></web-view> -->
  169. <!-- <image :show-menu-by-longpress="true" src="../../static/img/erweima.jpg" mode="widthFix" style="width: 100%;"></image> -->
  170. <!-- <button @click="wxgz" type="primary" style="background-color: #2d8cf0; margin-bottom: 30rpx;">关注公众号</button> -->
  171. </template>
  172. <script setup>
  173. import {
  174. ref
  175. } from 'vue'
  176. import {
  177. requestApi
  178. } from '@/api/request.js'
  179. // onShow是uni-app中的一个全局生命周期函数,当页面从后台进入前台显示时会被触发。
  180. import {
  181. onShow,
  182. } from '@dcloudio/uni-app'
  183. // import {Base64} from 'js-base64'
  184. let wxpopup = ref(null)
  185. let userInfo =wx.getStorageSync('userInfos')
  186. let stuts = ref(false)
  187. // console.log('w',userInfo)
  188. // 获取后端需要的token认证
  189. // 使用wx.getStorageSync('userInfo')从本地存储中获取用户令牌信息并将其赋值给user_Token变量。
  190. const data = ref([])
  191. onShow(async () => {
  192. wx.showLoading({
  193. title: '加载中',
  194. })
  195. const res = await requestApi('index.php/admin/borrow.borrowApp/apply')
  196. wx.hideLoading()
  197. // console.log(res)
  198. data.value = res.data.list
  199. // console.log('1',data.value)
  200. const ress= await requestApi(
  201. 'api/xmwechat.Offiaccount/isBind?server=1',
  202. {
  203. id:userInfo.userInfo.id,
  204. },
  205. 'POST'
  206. )
  207. // console.log(ress)
  208. if(ress.data.isBind=='ture'){
  209. // console.log(ress)
  210. }else{
  211. wxpopup.value.open('top');
  212. }
  213. })
  214. // 进详情页
  215. function detail(id) {
  216. wx.navigateTo({
  217. url: '/pages/index/detail?data=' + JSON.stringify(id)
  218. })
  219. }
  220. // 进借单申请页
  221. function application() {
  222. wx.navigateTo({
  223. url: '/pages/teacher/application'
  224. })
  225. }
  226. const paging = ref(null);
  227. const tabs = ref(null);
  228. const current = ref(0);
  229. const tabList = ref(['待审批/待使用', '使用中/逾期', '已驳回/已归还']);
  230. // tabs通知swiper切换
  231. const tabsChange = (index) => {
  232. current.value = index;
  233. }
  234. // swiper滑动中
  235. const swiperTransition = (e) => {
  236. tabs.value.setDx(e.detail.dx);
  237. }
  238. // swiper滑动结束
  239. const swiperAnimationfinish = (e) => {
  240. current.value = e.detail.current;
  241. tabs.value.unlockDx();
  242. }
  243. </script>
  244. <style lang="less">
  245. page {
  246. background-color: #fff;
  247. overflow: hidden;
  248. }
  249. .zp-swiper-super.data-v-bd8ff6a5 {
  250. background-color: rgb(244, 245, 249);
  251. }
  252. .search {
  253. margin: 20rpx 20rpx 0 20rpx;
  254. }
  255. .zp-swiper-container-fixed.data-v-bd8ff6a5 {
  256. // top: 100rpx !important;
  257. }
  258. swiper {
  259. min-height: 95vh;
  260. // overflow-y:auto;
  261. }
  262. .yiqijie{
  263. width: 280rpx;
  264. height: 90rpx;
  265. background-color: #2d8cf0;
  266. position: absolute;
  267. bottom: 80rpx;
  268. right: 50%;
  269. transform: translate(50%, 50%);
  270. border-radius: 50rpx;
  271. line-height: 90rpx;
  272. text-align: center;
  273. color: #fff;
  274. font-size: 35rpx;
  275. }
  276. .jie_card {
  277. width: 94%;
  278. margin: 30rpx auto;
  279. height: 270rpx;
  280. border-radius: 20rpx;
  281. background-color: #fff;
  282. // padding: 10rpx 0;
  283. }
  284. .tihuan_box {
  285. width: 84%;
  286. height: 500rpx;
  287. padding: 30rpx;
  288. background-color: #fff;
  289. margin: 30% auto;
  290. border-radius: 20rpx;
  291. }
  292. .jie_card_title {
  293. width: 100%;
  294. height: 84rpx;
  295. line-height: 84rpx;
  296. }
  297. .jie_swiper {
  298. // min-height: 1000rpx;
  299. background-color: rgb(244, 245, 249);
  300. }
  301. .jie_card_title_text {
  302. margin-left: 15rpx;
  303. line-height: center;
  304. // color: #606266;
  305. font-size: 28rpx;
  306. }
  307. .jie_tags {
  308. float: right;
  309. background-color: #E1F3D8;
  310. width: 104rpx;
  311. height: 42rpx;
  312. margin-top: 22rpx;
  313. border-radius: 23rpx 0 0 23rpx;
  314. font-size: 25rpx;
  315. padding-left: 10rpx;
  316. line-height: 40rpx;
  317. color: #529B2E;
  318. }
  319. .jie_tags2 {
  320. color: #B88230;
  321. background-color: #FAECD8;
  322. }
  323. .jie_contend {
  324. margin-left: 15rpx;
  325. margin-top: 15rpx;
  326. float: left;
  327. font-size: 31rpx;
  328. line-height: 42rpx;
  329. }
  330. .jie_contend_text {
  331. margin-bottom: 10rpx;
  332. }
  333. .jie_contend_text1 {
  334. color: #606266;
  335. }
  336. .jie_contend_text2 {
  337. color: #000;
  338. }
  339. .jie_card_ztai {
  340. width: 134rpx;
  341. height: 134rpx;
  342. background-color: #F89898;
  343. border-radius: 50%;
  344. line-height: 134rpx;
  345. float: right;
  346. color: #fff;
  347. font-size: 32rpx;
  348. text-align: center;
  349. margin-top: 25rpx;
  350. margin-right: 40rpx;
  351. }
  352. .jie_card_ztai2 {
  353. background-color: #A0CFFF;
  354. }
  355. </style>