index-nav.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <view>
  3. <swiper style="resistanceRatio : 0" class="swiper" :style="'height: '+currentPageHeight+'upx;'" duration="300"
  4. @change="categoryChange">
  5. <swiper-item v-for="(page, pageindex) in categoryList" :key="pageindex">
  6. <view class="category-list">
  7. <view class="icon" v-for="category in page" :key="category.cat_id" @tap="tapEvent(category)">
  8. <image mode="widthFix" :src="category.img"></image>
  9. <view class="category-title">{{ category.title }}</view>
  10. </view>
  11. </view>
  12. </swiper-item>
  13. </swiper>
  14. <view class="dots">
  15. <view v-for="(page, pageindex) in categoryList" :key="pageindex"
  16. :class="{ active: pageindex == currentPageindex }"></view>
  17. </view>
  18. <u-toast :type="type" ref="uToast"></u-toast>
  19. </view>
  20. </template>
  21. <script>
  22. import {
  23. mapState,
  24. mapMutations
  25. } from "vuex";
  26. import {
  27. pathToBase64,
  28. base64ToPath
  29. } from '@/common/image-tools-base64.js';
  30. import bankBin from "@/common/bankcardinfo.js"
  31. export default {
  32. props: {
  33. resdata: Array,
  34. row: {
  35. type: Number,
  36. default: 2
  37. }
  38. },
  39. data() {
  40. return {
  41. xuelishow: false,
  42. border: false,
  43. form: {
  44. name: "",
  45. identifyNumber: "",
  46. identifyValidDate: "",
  47. address: "",
  48. name4: "",
  49. name5: "",
  50. xueli: "",
  51. },
  52. labelPosition: 'left',
  53. errorType: ['message'],
  54. type: 'warning',
  55. title: '请先实名认证',
  56. icon: true,
  57. position: 'center',
  58. url: '',
  59. show1: false,
  60. content: '慈母手中线,游子身上衣',
  61. contentSlot: true,
  62. showTitle: false,
  63. asyncClose: false,
  64. currentPageindex: 0,
  65. currentPageHeight: "310upx",
  66. getApplicationStatus: "",
  67. }
  68. },
  69. computed: {
  70. categoryList() {
  71. this.currentPageHeight = 150 * this.row + 10;
  72. let totalPages = Math.floor(this.resdata.length / (this.row * 5));
  73. if (this.resdata.length % (this.row * 5) != 0) {
  74. totalPages += 1;
  75. }
  76. let list = [];
  77. for (let i = 0; i < totalPages; i++) {
  78. let item = [];
  79. item = this.resdata.slice(this.row * 5 * i, this.row * 5 * (i + 1));
  80. list.push(item)
  81. }
  82. return list;
  83. },
  84. ...mapState(['userInfo'])
  85. },
  86. onReady() {
  87. this.$refs.uForm.setRules(this.rules);
  88. },
  89. methods: {
  90. // 验证银行卡
  91. async validateBankCard() {
  92. var that = this;
  93. that.bankname = "";
  94. await bankBin.getBankBin(this.form.name4)
  95. .then((data) => {
  96. that.form.name5 = data.bankName;
  97. return true;
  98. })
  99. .catch((err) => {
  100. return uni.showToast({
  101. title: err.split(":")[1],
  102. icon: "none"
  103. });
  104. })
  105. },
  106. async chooseImage() {
  107. var _this = this;
  108. uni.chooseImage({
  109. count: 1,
  110. sizeType: "compressed",
  111. success(res) {
  112. pathToBase64(res.tempFilePaths[0])
  113. .then(async base64 => {
  114. var paramImg = {
  115. "image": base64, //图片base64
  116. "imgType": "1" //1身份证 2行驶证
  117. }
  118. let res2 = await _this.$http.post('/api/huanong/imgAI', paramImg);
  119. var data = res2.data.customerInfo;
  120. data.identifyValidDate = data.identifyValidDate.substr(0, 4) + '-' +
  121. data.identifyValidDate.substr(4, 2) + "-" + data.identifyValidDate
  122. .substr(6, 2)
  123. _this.form.name = data.name;
  124. _this.form.identifyNumber = data.identifyNumber;
  125. _this.form.identifyValidDate = data.identifyValidDate;
  126. })
  127. }
  128. });
  129. },
  130. show() {
  131. this.$refs.uToast.show({
  132. title: this.title,
  133. position: this.position,
  134. type: this.type,
  135. icon: this.icon,
  136. duration: 1000,
  137. });
  138. },
  139. event(item) {},
  140. //分类跳转
  141. async tapEvent(e) {
  142. this.form.name = "";
  143. this.form.identifyNumber = "";
  144. this.form.identifyValidDate = "";
  145. this.form.address = "";
  146. this.form.name4 = "";
  147. this.form.name5 = "";
  148. this.form.xueli = "";
  149. if(this.userInfo.sysUser.usertype=='A'){
  150. return uni.showToast({
  151. icon: "none",
  152. title: '没有权限',
  153. duration: 1500
  154. })
  155. }
  156. if (this.userInfo.sysUser.status == '2') {
  157. let res = await this.$http.get('/apps/getApplicationStatus?jobNumber=' + this.userInfo.sysUser.id);
  158. if (res.code == 200) {
  159. this.getApplicationStatus = res.data;
  160. if (this.getApplicationStatus == '0') {
  161. if (!e.src || e.src == '#' || e.src == '') {
  162. uni.showToast({
  163. icon: "none",
  164. title: '正在开发中...',
  165. duration: 1500
  166. })
  167. } else {
  168. uni.showToast({
  169. icon: "none",
  170. title: '实名认证等待审核中',
  171. duration: 1500
  172. })
  173. }
  174. } else if (this.getApplicationStatus == '3') {
  175. if (!e.src || e.src == '#' || e.src == '') {
  176. uni.showToast({
  177. icon: "none",
  178. title: '正在开发中...',
  179. duration: 1500
  180. })
  181. } else {
  182. uni.showToast({
  183. icon: "none",
  184. title: '实名认证不通过,请修改后提交',
  185. duration: 1500
  186. })
  187. setTimeout(() => {
  188. uni.navigateTo({
  189. url: '/pages/user/certification'
  190. })
  191. }, 1000)
  192. }
  193. }
  194. } else {
  195. if (!e.src || e.src == '#' || e.src == '') {
  196. uni.showToast({
  197. icon: "none",
  198. title: '正在开发中...',
  199. duration: 1500
  200. })
  201. } else {
  202. this.show();
  203. setTimeout(() => {
  204. uni.navigateTo({
  205. url: '/pages/user/infoInput'
  206. })
  207. }, 1000)
  208. }
  209. }
  210. } else if (this.userInfo.sysUser.status == '1') {
  211. if (!e.src || e.src == '#' || e.src == '') {
  212. uni.showToast({
  213. icon: "none",
  214. title: '正在开发中...',
  215. duration: 1500
  216. })
  217. } else {
  218. this.navigate({
  219. url: e.src
  220. }, "navigateTo", true)
  221. }
  222. } else {
  223. this.show1 = false;
  224. }
  225. },
  226. xueliConfirm(e) {
  227. this.form.xueli = e[0].value;
  228. },
  229. //更新分类指示器
  230. categoryChange(event) {
  231. this.currentPageindex = event.detail.current;
  232. }
  233. }
  234. }
  235. </script>
  236. <style lang="scss" scoped>
  237. .dots {
  238. display: flex;
  239. justify-content: center;
  240. height: 15upx;
  241. width: 100%;
  242. }
  243. .dots>view {
  244. width: 30upx;
  245. height: 5upx;
  246. background-color: rgba(0, 0, 0, 0.2);
  247. }
  248. .dots>view.active {
  249. background-color: #0A98D5;
  250. }
  251. .swiper {
  252. padding: 10upx 0upx;
  253. }
  254. .category-list {
  255. width: 100%;
  256. height: auto;
  257. display: flex;
  258. justify-content: flex-start;
  259. flex-flow: wrap;
  260. }
  261. .category-title {
  262. font-size: 25upx;
  263. }
  264. .icon {
  265. margin-top: 5upx;
  266. margin-bottom: 5upx;
  267. width: 20%;
  268. height: 150upx;
  269. display: flex;
  270. flex-flow: wrap;
  271. justify-content: center;
  272. font-size: 25upx;
  273. color: #666;
  274. }
  275. .icon image {
  276. margin: 5upx;
  277. width: 65%;
  278. }
  279. .icon>view {
  280. width: 100%;
  281. display: flex;
  282. justify-content: center;
  283. }
  284. </style>