index-nav.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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. uni.showToast({
  158. icon: "none",
  159. title: '请先通过实名认证',
  160. duration: 1500
  161. })
  162. }
  163. else if (this.userInfo.sysUser.status == '1') {
  164. if (!e.src || e.src == '#' || e.src == '') {
  165. uni.showToast({
  166. icon: "none",
  167. title: '正在开发中...',
  168. duration: 1500
  169. })
  170. } else {
  171. this.navigate({
  172. url: e.src
  173. }, "navigateTo", true)
  174. }
  175. }
  176. // if (this.userInfo.sysUser.status == '2') {
  177. // let res = await this.$http.get('/apps/getApplicationStatus?jobNumber=' + this.userInfo.sysUser.id);
  178. // if (res.code == 200) {
  179. // this.getApplicationStatus = res.data;
  180. // if (this.getApplicationStatus == '0') {
  181. // if (!e.src || e.src == '#' || e.src == '') {
  182. // uni.showToast({
  183. // icon: "none",
  184. // title: '正在开发中...',
  185. // duration: 1500
  186. // })
  187. // } else {
  188. // uni.showToast({
  189. // icon: "none",
  190. // title: '该账户已删除',
  191. // duration: 1500
  192. // })
  193. // }
  194. // } else if (this.getApplicationStatus == '3') {
  195. // if (!e.src || e.src == '#' || e.src == '') {
  196. // uni.showToast({
  197. // icon: "none",
  198. // title: '正在开发中...',
  199. // duration: 1500
  200. // })
  201. // } else {
  202. // uni.showToast({
  203. // icon: "none",
  204. // title: '实名认证不通过,请修改后提交',
  205. // duration: 1500
  206. // })
  207. // setTimeout(() => {
  208. // uni.navigateTo({
  209. // url: '/pages/user/certification'
  210. // })
  211. // }, 1000)
  212. // }
  213. // }
  214. // else if (this.getApplicationStatus == '2') {
  215. // uni.showToast({
  216. // icon: "none",
  217. // title: '请先通过实名认证',
  218. // duration: 1500
  219. // })
  220. // }
  221. // } else {
  222. // if (!e.src || e.src == '#' || e.src == '') {
  223. // uni.showToast({
  224. // icon: "none",
  225. // title: '正在开发中...',
  226. // duration: 1500
  227. // })
  228. // } else {
  229. // this.show();
  230. // setTimeout(() => {
  231. // uni.navigateTo({
  232. // url: '/pages/user/infoInput'
  233. // })
  234. // }, 1000)
  235. // }
  236. // }
  237. // } else if (this.userInfo.sysUser.status == '1') {
  238. // if (!e.src || e.src == '#' || e.src == '') {
  239. // uni.showToast({
  240. // icon: "none",
  241. // title: '正在开发中...',
  242. // duration: 1500
  243. // })
  244. // } else {
  245. // this.navigate({
  246. // url: e.src
  247. // }, "navigateTo", true)
  248. // }
  249. // } else {
  250. // this.show1 = false;
  251. // }
  252. },
  253. xueliConfirm(e) {
  254. this.form.xueli = e[0].value;
  255. },
  256. //更新分类指示器
  257. categoryChange(event) {
  258. this.currentPageindex = event.detail.current;
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang="scss" scoped>
  264. .dots {
  265. display: flex;
  266. justify-content: center;
  267. height: 15upx;
  268. width: 100%;
  269. }
  270. .dots>view {
  271. width: 30upx;
  272. height: 5upx;
  273. background-color: rgba(0, 0, 0, 0.2);
  274. }
  275. .dots>view.active {
  276. background-color: #0A98D5;
  277. }
  278. .swiper {
  279. padding: 10upx 0upx;
  280. }
  281. .category-list {
  282. width: 100%;
  283. height: auto;
  284. display: flex;
  285. justify-content: flex-start;
  286. flex-flow: wrap;
  287. }
  288. .category-title {
  289. font-size: 25upx;
  290. }
  291. .icon {
  292. margin-top: 5upx;
  293. margin-bottom: 5upx;
  294. width: 20%;
  295. height: 150upx;
  296. display: flex;
  297. flex-flow: wrap;
  298. justify-content: center;
  299. font-size: 25upx;
  300. color: #666;
  301. }
  302. .icon image {
  303. margin: 5upx;
  304. width: 65%;
  305. }
  306. .icon>view {
  307. width: 100%;
  308. display: flex;
  309. justify-content: center;
  310. }
  311. </style>