Browse Source

贷款-接数据

panyong 4 năm trước cách đây
mục cha
commit
ba9071d4be

+ 11 - 0
htmldev/loan/src/api/common.js

@@ -8,6 +8,17 @@ export const getChinaArea = () => request({
   url: '/area'
 })
 
+/*
+* 获取网点列表
+* */
+export const getBankList = (id) => request({
+  method: 'GET',
+  url: '/home/bank/bankList',
+  params: {
+    id
+  }
+})
+
 /*
 * 短信发送
 * */

+ 1 - 1
htmldev/loan/src/api/request.js

@@ -27,7 +27,7 @@ request.interceptors.response.use(response => {
 }, (error) => {
   // Do something with response error
   if (error.response && error.response.status === 301) {
-    // location.replace(error.response.data.authorize_url)
+    location.replace(error.response.data.authorize_url)
   }
   return Promise.reject(error)
 })

+ 15 - 11
htmldev/loan/src/router/index.js

@@ -22,30 +22,34 @@ const routes = [
       keepAlive: true
     }
   },
-  {
-    path: '/loan/detail', // 进度查询:贷款详情页
-    name: 'loanDetail',
-    component: () => import(/* webpackChunkName: "loan_detail" */ '../views/loan/detail')
-  },
   {
     path: '/loan/explain', // 贷款介绍
     name: 'loanExplain',
     component: () => import(/* webpackChunkName: "loan_goods" */ '../views/loan/explain')
   },
   {
-    path: '/loan/apply', // 基本信息填写
+    path: '/loan/apply/:orderProductId', // 基本信息填写
     name: 'loanApply',
-    component: () => import(/* webpackChunkName: "loan_apply" */ '../views/loan/apply')
+    component: () => import(/* webpackChunkName: "loan_apply" */ '../views/loan/apply'),
+    props: true
+  },
+  {
+    path: '/loan/detail/:id', // 进度查询:贷款详情页
+    name: 'loanDetail',
+    component: () => import(/* webpackChunkName: "loan_detail" */ '../views/loan/detail'),
+    props: true
   },
   {
-    path: '/loan/attest', // 上传资料
+    path: '/loan/attest/:id', // 上传资料
     name: 'loanAttest',
-    component: () => import(/* webpackChunkName: "loan_attest" */ '../views/loan/attest')
+    component: () => import(/* webpackChunkName: "loan_attest" */ '../views/loan/attest'),
+    props: true
   },
   {
-    path: '/loan/bespeak', // 预约现场办理时间
+    path: '/loan/bespeak/:id', // 预约现场办理时间
     name: 'loanBespeak',
-    component: () => import(/* webpackChunkName: "loan_bespeak" */ '../views/loan/bespeak')
+    component: () => import(/* webpackChunkName: "loan_bespeak" */ '../views/loan/bespeak'),
+    props: true
   },
   {
     path: '/loan/privacy', // 隐私协议

+ 7 - 0
htmldev/loan/src/views/loan/apply/api/index.js

@@ -0,0 +1,7 @@
+import request from '@/api/request'
+
+export const createOrder = (postData) => request({
+  method: 'POST',
+  url: '/home/applyOrder/createOrder',
+  data: postData
+})

+ 66 - 64
htmldev/loan/src/views/loan/apply/index.vue

@@ -9,12 +9,12 @@
         </label>
         <div class="value-wrap">
           <div class="value-name">
-            <input type="text" placeholder="请输入姓名" v-model.trim="postData.name">
+            <input type="text" placeholder="请输入姓名" v-model.trim="postData.orderUserName">
           </div>
           <div class="value-gender">
-            <p v-for="(str, index) in ['男', '女']" :key="index" @click="postData.gender = index">
-              <img src="./image/btn_xingbie_sel@2x.png" alt="" v-show="postData.gender === index">
-              <img src="./image/btn_xingbie_nor@2x.png" alt="" v-show="postData.gender !== index">
+            <p v-for="(str, index) in ['男', '女']" :key="index" @click="postData.orderUserSex = index">
+              <img src="./image/btn_xingbie_sel@2x.png" alt="" v-show="postData.orderUserSex === index">
+              <img src="./image/btn_xingbie_nor@2x.png" alt="" v-show="postData.orderUserSex !== index">
               <span>{{ str }}</span>
             </p>
           </div>
@@ -25,7 +25,7 @@
           <span v-for="(str, index) in '手机号码:'" :key="index">{{ str }}</span>
         </label>
         <div class="value-wrap">
-          <input type="number" placeholder="请输入手机号码" v-model.trim="postData.phone" @input="funLimitLength">
+          <input type="number" placeholder="请输入手机号码" v-model.trim="postData.orderUserPhone" @input="funLimitLength">
         </div>
       </li>
       <li>
@@ -51,8 +51,8 @@
           <span v-for="(str, index) in '所在城市:'" :key="index">{{ str }}</span>
         </label>
         <div class="value-wrap" @click="showPicker = true">
-          <p class="value-city" v-show="postData.province">{{ postData.province + postData.city}}</p>
-          <p class="value-city init" v-show="!postData.province">请选择所在城市</p>
+          <p class="value-city" v-show="postData.orderProvince">{{ postData.orderProvince + postData.orderCity}}</p>
+          <p class="value-city init" v-show="!postData.orderProvince">请选择所在城市</p>
           <img src="./image/btn_next@2x.png" alt="">
         </div>
       </li>
@@ -61,7 +61,8 @@
           <span v-for="(str, index) in '房产地址:'" :key="index">{{ str }}</span>
         </label>
         <div class="value-wrap">
-          <textarea name="" rows="1" placeholder="请输入房产地址" v-model.trim="postData.address" ref="myTextarea"></textarea>
+          <textarea name="" rows="1" placeholder="请输入房产地址" v-model.trim="postData.orderAddress"
+                    ref="myTextarea"></textarea>
         </div>
       </li>
       <li>
@@ -69,9 +70,9 @@
           <span v-for="(str, index) in '需求金额:'" :key="index">{{ str }}</span>
         </label>
         <div class="value-wrap amount-wrap">
-          <input :class="{'opacity-0': postData.amount * 1 > 0}" type="number" placeholder="请输入需求金额"
+          <input :class="{'opacity-0': postData.orderPrice * 1 > 0}" type="number" placeholder="请输入需求金额"
                  v-model.trim="amount">
-          <p v-show="postData.amount * 1 > 0">{{ postData.amount * 1 | toThousands }}.00</p>
+          <p v-show="postData.orderPrice * 1 > 0">{{ postData.orderPrice * 1 | toThousands }}.00</p>
         </div>
       </li>
     </ul>
@@ -96,6 +97,8 @@
 <script>
   import Flow from './components/flow'
   import { Popup, Picker, Toast } from 'vant'
+  import { createOrder } from './api'
+  import { getChinaArea, sendSMS } from '../../../api/common'
 
   const STRCAPTURE = '//daikuanapi.codedreamit.com/captcha'
   export default {
@@ -105,63 +108,47 @@
       'van-popup': Popup,
       'van-picker': Picker
     },
+    props: {
+      // 产品ID
+      orderProductId: {
+        type: String,
+        default: ''
+      }
+    },
     data () {
       return {
         postData: {
-          name: '',
-          gender: -1,
-          phone: '',
-          code: '',
+          orderUserName: '', // 用户名称
+          orderUserSex: '',
+          orderUserPhone: '', // 手机号码
+          code: '', // 验证码
           capture: '',
-          province: '',
-          city: '',
-          address: '',
-          amount: ''
+          orderPrice: '', // 申请金额
+          orderProvince: '', // 省份
+          orderCity: '', // 城市
+          orderDistrict: '', // 区域
+          orderAddress: '' // 详细地址
         },
         numCount: 60,
         arrErrorList: [],
         strCapture: STRCAPTURE,
         showPicker: false,
-        columns: [
-          {
-            text: '浙江',
-            children: [
-              {
-                text: '杭州'
-                // children: [{ text: '西湖区' }, { text: '余杭区' }]
-              },
-              {
-                text: '温州'
-                // children: [{ text: '鹿城区' }, { text: '瓯海区' }]
-              }
-            ]
-          },
-          {
-            text: '福建',
-            children: [
-              {
-                text: '福州'
-                // children: [{ text: '鼓楼区' }, { text: '台江区' }]
-              },
-              {
-                text: '厦门'
-                // children: [{ text: '思明区' }, { text: '海沧区' }]
-              }
-            ]
-          }
-        ]
+        columns: []
       }
     },
     computed: {
       amount: {
         get () {
-          return this.postData.amount ? this.postData.amount * 1 : ''
+          return this.postData.orderPrice ? this.postData.orderPrice * 1 : ''
         },
         set (value) {
-          this.postData.amount = value
+          this.postData.orderPrice = value
         }
       }
     },
+    created () {
+      this.funGetChinaArea()
+    },
     async mounted () {
       await this.$nextTick()
       const textarea = this.$refs.myTextarea
@@ -175,6 +162,13 @@
       this.$refreshTitle('中行贷')
     },
     methods: {
+      funGetChinaArea () {
+        getChinaArea().then(res => {
+          if (res.status) {
+            this.columns = res.data
+          }
+        })
+      },
       handleTextarea (el, auto) {
         return () => {
           if (auto) {
@@ -185,12 +179,12 @@
       },
       onConfirm (value) {
         this.showPicker = false
-        this.$set(this.postData, 'province', value[0])
-        this.$set(this.postData, 'city', value[1])
+        this.$set(this.postData, 'orderProvince', value[0])
+        this.$set(this.postData, 'orderCity', value[1])
       },
       funLimitLength () {
-        const { phone, code } = this.postData
-        this.postData.phone = phone.length > 11 ? phone.slice(0, 11) : phone
+        const { orderUserPhone, code } = this.postData
+        this.postData.orderUserPhone = orderUserPhone.length > 11 ? orderUserPhone.slice(0, 11) : orderUserPhone
         this.postData.code = code.length > 4 ? code.slice(0, 4) : code
       },
       funCutDown () {
@@ -208,12 +202,12 @@
       // 获取验证码
       funGetCode () {
         const numCount = this.numCount
-        const { phone, capture } = this.postData
+        const { orderUserPhone, capture } = this.postData
         if (numCount < 60 && numCount > 0) {
           return
         }
         this.numCount = 60
-        if (!(/^1[2|3|4|5|6|7|8|9]\d{9}$/.test(phone))) {
+        if (!(/^1[2|3|4|5|6|7|8|9]\d{9}$/.test(orderUserPhone))) {
           Toast('请输入手机号码')
           return
         }
@@ -223,31 +217,35 @@
           return
         }
         this.funCutDown()
-        this.funUpdateCapture()
-        // todo ajax
+        sendSMS(orderUserPhone, 0, capture).then(res => {
+          Toast(res.msg)
+        }).catch(err => {
+          Toast(err.msg)
+          this.funUpdateCapture()
+        })
       },
       verifyData () {
-        const { name, gender, phone, code, province, city, address, amount } = this.postData
+        const { orderUserName, orderUserSex, orderUserPhone, code, orderProvince, orderCity, orderAddress, orderPrice } = this.postData
         this.arrErrorList = []
-        if (!name) {
+        if (!orderUserName) {
           this.arrErrorList.push('请输入姓名')
         }
-        if (gender < 0) {
+        if (orderUserSex < 0) {
           this.arrErrorList.push('请选择性别')
         }
-        if (!/^1[2|3|4|5|6|7|8|9]\d{9}$/.test(phone)) {
+        if (!/^1[2|3|4|5|6|7|8|9]\d{9}$/.test(orderUserPhone)) {
           this.arrErrorList.push('请输入手机号码')
         }
         if (!(/^\d{4}$/.test(code))) {
           this.arrErrorList.push('请输入验证码')
         }
-        if (!province || !city) {
+        if (!orderProvince || !orderCity) {
           this.arrErrorList.push('请选择所在城市')
         }
-        if (!address) {
+        if (!orderAddress) {
           this.arrErrorList.push('请输入房产地址')
         }
-        if (amount * 1 <= 0) {
+        if (orderPrice * 1 <= 0) {
           this.arrErrorList.push('请输入需求金额')
         }
         return this.arrErrorList.length <= 0
@@ -262,7 +260,11 @@
             forbidClick: true
           })
         }
-        this.$router.replace({ path: '/loan/detail' })
+        createOrder().then(() => {
+          this.$router.replace({ path: '/loan/detail' })
+        }).catch(err => {
+          Toast(err)
+        })
       }
     }
   }

+ 7 - 1
htmldev/loan/src/views/loan/attest/index.vue

@@ -39,6 +39,12 @@
     components: {
       MyUploader
     },
+    props: {
+      id: {
+        type: String,
+        default: ''
+      }
+    },
     data () {
       return {
         uploadType0: 'credit',
@@ -73,7 +79,7 @@
       },
       funSubmit () {
         const postData = {
-          id: 0,
+          id: this.id,
           checkContent1: this.creditReport,
           checkContent2: this.houseProperty
         }

+ 7 - 0
htmldev/loan/src/views/loan/bespeak/api/index.js

@@ -0,0 +1,7 @@
+import request from '@/api/request'
+
+export const postBespeak = (postData) => request({
+  method: 'POST',
+  url: '/home/applyOrder/yuyueTime',
+  data: postData
+})

+ 58 - 8
htmldev/loan/src/views/loan/bespeak/index.vue

@@ -7,9 +7,9 @@
         <img src="./image/date@2x.png">
         <p>{{ bespeakTime ? bespeakTime : '请选择时间' }}</p>
       </li>
-      <li>
+      <li @click="showStorePicker = true">
         <img src="./image/position@2x.png">
-        <p>请选择办理网点</p>
+        <p>{{ storeName ? storeName : '请选择办理网点'}}</p>
       </li>
     </ul>
     <button class="submit" @click="funSubmit">提交</button>
@@ -24,17 +24,35 @@
         @cancel="showPicker = false"
         @confirm="onConfirm"/>
     </van-popup>
+    <van-popup v-model="showStorePicker" round position="bottom">
+      <van-picker
+        title="请选择办理网点"
+        show-toolbar
+        :columns="columns"
+        @confirm="onStorePickerConfirm"
+        @cancel="showStorePicker = false"/>
+    </van-popup>
   </div>
 </template>
 
 <script>
-  import { Popup, DatetimePicker, Toast } from 'vant'
+  import { Popup, DatetimePicker, Picker, Toast } from 'vant'
+  import { postBespeak } from './api'
+  import { getBankList } from '../../../api/common'
 
   export default {
     name: 'bespeak',
     components: {
       'van-popup': Popup,
-      'van-datetime-picker': DatetimePicker
+      'van-datetime-picker': DatetimePicker,
+      'van-picker': Picker
+    },
+    props: {
+      // 订单ID
+      id: {
+        type: String,
+        default: ''
+      }
     },
     data () {
       return {
@@ -42,9 +60,15 @@
         showPicker: false,
         minDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()),
         maxDate: new Date(new Date().getFullYear() + 3, 12, 31),
-        currentDate: new Date()
+        currentDate: new Date(),
+        storeName: '',
+        showStorePicker: false,
+        columns: []
       }
     },
+    created () {
+      this.funGetBankList()
+    },
     async mounted () {
       await this.$nextTick()
       this.$refreshTitle('进度查询')
@@ -64,10 +88,36 @@
         }
         this.showPicker = false
         this.bespeakTime = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours().toString().padStart(2, '0') + ':' + date.getSeconds().toString().padStart(2, '0')
-        // this.$set(this.postData, 'province', value[0])
-        // this.$set(this.postData, 'city', value[1])
       },
-      funSubmit () {}
+      onStorePickerConfirm (value) {
+        this.storeName = value
+        this.showStorePicker = false
+      },
+      funGetBankList () {
+        getBankList(this.id).then(res => {
+          if (res.status) {
+            this.columns = res.data
+          }
+        })
+      },
+      funSubmit () {
+        const postData = {
+          id: this.id,
+          bankName: this.storeName,
+          time: this.bespeakTime // 预约时间
+        }
+        if (!postData.time) {
+          Toast('请选择时间')
+          return
+        }
+        if (!postData.bankName) {
+          Toast('请选择办理网点')
+          return
+        }
+        postBespeak(postData).then(res => {
+          this.$router.push({ path: `/loan/detail/${postData.id}` })
+        })
+      }
     }
   }
 </script>

+ 9 - 0
htmldev/loan/src/views/loan/detail/api/index.js

@@ -0,0 +1,9 @@
+import request from '@/api/request'
+
+export const getOrderDetail = (id) => request({
+  method: 'GET',
+  url: '/home/applyOrder/orderDetail',
+  params: {
+    id
+  }
+})

+ 13 - 0
htmldev/loan/src/views/loan/detail/index.vue

@@ -125,11 +125,24 @@
 </template>
 
 <script>
+  import { getOrderDetail } from './api'
+
   export default {
     name: 'detail',
+    props: {
+      id: {
+        type: String,
+        default: ''
+      }
+    },
     async mounted () {
       await this.$nextTick()
       this.$refreshTitle('进度查询')
+    },
+    methods: {
+      funInit () {
+        getOrderDetail(this.id).then()
+      }
     }
   }
 </script>

+ 10 - 0
htmldev/loan/src/views/loan/home/api/index.js

@@ -0,0 +1,10 @@
+import request from '@/api/request'
+
+export const getOrderList = (page = 1, pageNum = 20) => request({
+  method: 'POST',
+  url: '/home/applyOrder/orderList',
+  data: {
+    page,
+    pageNum
+  }
+})

+ 2 - 9
htmldev/loan/src/views/loan/home/index.vue

@@ -34,8 +34,7 @@
 <script>
   import BScroll from 'better-scroll'
   import { Toast } from 'vant'
-  import axios from 'axios'
-  import { sendSMS } from '../../../api/common'
+  import { getOrderList } from './api'
 
   const PAGESIZE = 20
   export default {
@@ -73,9 +72,6 @@
         this.booFetchData = false
         this.numPositionY = 0
         this.funFetch()
-        sendSMS('13429176706', '000', '1111').then(res => {
-          console.log(res)
-        })
       } else {
         this.$nextTick(() => {
           if (this.scroll) {
@@ -92,10 +88,7 @@
     methods: {
       funFetch () {
         const vm = this
-        axios.post('/', {
-          Page: vm.pager.pagenum,
-          PageSize: vm.pager.pagesize
-        }).then(response => {
+        getOrderList(vm.pager.pagenum, vm.pager.pagesize).then(response => {
           if (response.Status === 1) {
             const data = response.Data
             vm.pager.pagecount = data.pageCount * 1