合同小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1005 lines
31 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="containers" >
  3. <view class="header">
  4. <view class="header_info">
  5. <view class="header_info_icon" @click.native.stop.prevent="toBack" style="display: flex; justify-content: center; align-items: center;">
  6. <uni-icons type="left" size="30" color="#c2d4de" > </uni-icons>
  7. </view>
  8. <text class="header_text">信息录入</text>
  9. </view>
  10. </view>
  11. <view class="section" style="margin-top: 5%;">
  12. <view class="form-item">
  13. <text class="label">付款方式</text>
  14. <l-radio :checked="clientInfo.payType === '全款'" label="全款" fontSize="1rem" style="transform: scale(0.7);">
  15. <template #icon="{checked}">
  16. <image v-show="checked" style="width:1.2rem; height:1.2rem;" src="/static/image/xuanzhong.png"></image>
  17. <image v-show="!checked" style="width:1.2rem; height:1.2rem" src="/static/image/weixuanzhong.png"></image>
  18. </template>
  19. </l-radio>
  20. </view>
  21. <view class="form-item">
  22. <text class="label">客户类型</text>
  23. <l-radio-group @change="onChange" class="radio-group" >
  24. <l-radio :checked= "clientInfo.custType == 0?true:false" value="个人" label="个人" fontSize="1rem" style="margin-right: 1rem; transform: scale(0.7);">
  25. <template #icon="{checked}">
  26. <image v-show="checked" style="width:1.2rem; height:1.2rem;" src="/static/image/xuanzhong.png"></image>
  27. <image v-show="!checked" style="width:1.2rem; height:1.2rem" src="/static/image/weixuanzhong.png"></image>
  28. </template>
  29. </l-radio>
  30. <l-radio :checked= "clientInfo.custType == 1?true:false" value="公司" label="公司" fontSize="1rem" style="transform: scale(0.7);">
  31. <template #icon="{checked}">
  32. <image v-show="checked" style="width:1.2rem; height:1.2rem;" src="/static/image/xuanzhong.png"></image>
  33. <image v-show="!checked" style="width:1.2rem; height:1.2rem" src="/static/image/weixuanzhong.png"></image>
  34. </template>
  35. </l-radio>
  36. </l-radio-group>
  37. </view>
  38. </view>
  39. <view class="idCard-box">
  40. <view class="reverse" @tap.prevent="uploadPositive">
  41. <image :src="clientInfo.certFront == ''?positiveImg:certFront" >
  42. </image>
  43. <text v-if="certFront == ''?true:false">身份证人像面</text>
  44. </view>
  45. <view class="reverse" @tap.prevent="uploadReverse">
  46. <image :src="clientInfo.certBack == ''?reverseImg:certBack" >
  47. </image>
  48. <text v-if="certBack == ''?true:false">身份证国徽面</text>
  49. </view>
  50. <view class="reverse" @tap.prevent="uploadCarCert">
  51. <image :src="clientInfo.carPic == ''?carImg:carPic" >
  52. </image>
  53. <text v-if="carPic == ''?true:false">车辆合格证</text>
  54. </view>
  55. </view>
  56. <!-- 客户基本信息 -->
  57. <view class="section">
  58. <view class="con_size">
  59. <image src="/static/image/矩形 5315.png" class='con_size_img' ></image>
  60. 客户基本信息
  61. </view>
  62. <view class="form-item">
  63. <text class="labels">*</text>
  64. <text class="label">产品名称</text>
  65. <text class="value">{{ clientInfo.productName }}</text>
  66. </view>
  67. <view class="form-item">
  68. <text class="labels">*</text>
  69. <text class="label">经销商</text>
  70. <text class="value">{{ clientInfo.storeName }}</text>
  71. </view>
  72. <view class="form-item">
  73. <text class="labels">*</text>
  74. <text class="label">客户姓名</text>
  75. <textarea auto-height :adjust-position="true" :disabled='isTrue' class="input" v-model="clientInfo.custName" placeholder="请输入客户姓名" />
  76. </view>
  77. <view class="form-item">
  78. <text class="labels">*</text>
  79. <text class="label">居住地址</text>
  80. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.custAddress" placeholder="请输入居住地址" />
  81. </view>
  82. <view class="form-item" :style="{ paddingBottom: keyboardHeight + 'px' }">
  83. <text class="labels">*</text>
  84. <text class="label">身份证号码</text>
  85. <textarea auto-height :adjust-position="true" @focus="handleFocus" class="input" v-model="clientInfo.custCardNo" placeholder="请输入身份证号码" />
  86. </view>
  87. <view class="form-item">
  88. <text class="labels">*</text>
  89. <text class="label">联系方式</text>
  90. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.custPhone" placeholder="请输入联系方式" />
  91. </view>
  92. <view class="form-item">
  93. <text class="labels">*</text>
  94. <text class="label">销售端口</text>
  95. <l-radio-group class="radio-group" @change="handleDepartmentChange">
  96. <label class="radio-label" v-for="item in departments" :key="item">
  97. <l-radio :value="item" :checked="clientInfo.salePort === item" >
  98. <template #icon="{checked}">
  99. <image v-show="checked" style="width:1.2rem; height:1.2rem;" src="/static/image/xuanzhong.png"></image>
  100. <image v-show="!checked" style="width:1.2rem; height:1.2rem" src="/static/image/weixuanzhong.png"></image>
  101. </template>
  102. </l-radio>
  103. <text style="margin-left:0.2rem;">{{ item }}</text>
  104. </label>
  105. </l-radio-group>
  106. </view>
  107. <view class="form-item">
  108. <text class="labels">*</text>
  109. <text class="label">店端销售顾问</text>
  110. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.saleName" placeholder="请输入店铺销售顾问" />
  111. </view>
  112. </view>
  113. <!-- 车辆信息 -->
  114. <view class="section">
  115. <view class="con_size">
  116. <image src="/static/image/矩形 5315.png" class='con_size_img' ></image>车辆信息</view>
  117. <view class="form-item">
  118. <text class="labels">*</text>
  119. <text class="label">车牌车系</text>
  120. <view class="picker" @click="getCar">
  121. <view class="picker-text">{{ clientInfo.appOrderCarList[0].carSeries || '请选择车辆品牌 >' }}</view>
  122. </view>
  123. </view>
  124. <view class="form-item">
  125. <text class="labels">*</text>
  126. <text class="label">车辆型号</text>
  127. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderCarList[0].carModel" placeholder="请输入车辆型号" />
  128. </view>
  129. <view class="form-item">
  130. <text class="labels">*</text>
  131. <text class="label">车架号</text>
  132. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderCarList[0].vin" placeholder="请输入车架号" />
  133. </view>
  134. <view class="form-item">
  135. <text class="labels">*</text>
  136. <text class="label">车辆类型</text>
  137. <picker class="picker" @change="bindCarBrandChanges" :value="carBrandIndex" :range="carType">
  138. <view class="picker-text">{{ clientInfo.appOrderCarList[0].carType || '请选择车辆类型 >' }}</view>
  139. </picker>
  140. </view>
  141. <view class="form-item">
  142. <text class="labels">*</text>
  143. <text class="label">使用性质</text>
  144. <picker class="picker" @change="binduseTypeChanges" :value="useTypeIndex" :range="useType">
  145. <view class="picker-text">{{ clientInfo.appOrderCarList[0].useType || '请选择使用性质 >' }}</view>
  146. </picker>
  147. </view>
  148. <view class="form-item">
  149. <text class="labels">*</text>
  150. <text class="label">是否新车</text>
  151. <l-radio-group @change="onChanges" class="radio-group" >
  152. <l-radio :checked= "clientInfo.appOrderCarList[0].newCar == 1?true:false" value="是" label="是" fontSize="1rem" style="margin-right: 1rem; transform: scale(0.7);">
  153. <template #icon="{checked}">
  154. <image v-show="checked" style="width:1.2rem; height:1.2rem;" src="/static/image/xuanzhong.png"></image>
  155. <image v-show="!checked" style="width:1.2rem; height:1.2rem" src="/static/image/weixuanzhong.png"></image>
  156. </template>
  157. </l-radio>
  158. <l-radio :checked= "clientInfo.appOrderCarList[0].newCar == 0?true:false" value="否" label="否" fontSize="1rem" style="transform: scale(0.7);">
  159. <template #icon="{checked}">
  160. <image v-show="checked" style="width:1.2rem; height:1.2rem;" src="/static/image/xuanzhong.png"></image>
  161. <image v-show="!checked" style="width:1.2rem; height:1.2rem" src="/static/image/weixuanzhong.png"></image>
  162. </template>
  163. </l-radio>
  164. </l-radio-group>
  165. </view>
  166. <view class="form-item">
  167. <text class="label">车牌号</text>
  168. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderCarList[0].carNo" placeholder="请输入车牌号" />
  169. </view>
  170. <view class="form-item">
  171. <text class="labels">*</text>
  172. <text class="label">发动机号</text>
  173. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderCarList[0].engineNo" placeholder="请输入发动机号" />
  174. </view>
  175. <view class="form-item">
  176. <text class="labels">*</text>
  177. <text class="label">里程</text>
  178. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderCarList[0].mileage" placeholder="请输入里程" />
  179. </view>
  180. <view class="form-item">
  181. <text class="labels">*</text>
  182. <text class="label">购车时间</text>
  183. <uni-datetime-picker v-model="clientInfo.appOrderCarList[0].buyTime" @change = 'changeEffectiveTime' :clearIcon="false" :border="false" >
  184. </uni-datetime-picker>
  185. </view>
  186. <view class="form-item">
  187. <text class="labels">*</text>
  188. <text class="label">车辆购置价</text>
  189. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderCarList[0].buyMoney" @input= 'changebuyTax' placeholder="请输入车辆购置价" />
  190. </view>
  191. <view class="form-item">
  192. <text class="labels">*</text>
  193. <text class="label">购置税</text>
  194. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderCarList[0].buyTax" placeholder="请输入购置税" />
  195. </view>
  196. </view>
  197. <!-- 凭证信息 -->
  198. <view class="section">
  199. <view class="con_size">
  200. <image src="/static/image/矩形 5315.png" class='con_size_img' ></image>凭证信息</view>
  201. <view class="form-item">
  202. <text class="labels">*</text>
  203. <text class="label">第一受益人</text>
  204. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderVoucherList[0].firstBeneficiary" placeholder="请输入第一受益人" />
  205. </view>
  206. <view class="form-item">
  207. <text class="labels">*</text>
  208. <text class="label">服务费</text>
  209. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderVoucherList[0].serviceMoney" placeholder="请输入服务费" />
  210. </view>
  211. <view class="form-item">
  212. <text class="labels">*</text>
  213. <text class="label">生效时间</text>
  214. <uni-datetime-picker v-model="clientInfo.appOrderVoucherList[0].effectiveTime" type="date" :clearIcon="false" :border="false" >
  215. </uni-datetime-picker>
  216. </view>
  217. <view class="form-item">
  218. <text class="labels">*</text>
  219. <text class="label">失效时间</text>
  220. <uni-datetime-picker v-model="clientInfo.appOrderVoucherList[0].endTime" type="date" :clearIcon="false" :border="false" >
  221. </uni-datetime-picker>
  222. </view>
  223. <view class="form-item">
  224. <text class="labels">*</text>
  225. <text class="label">服务年限</text>
  226. <picker class="picker" @change="changeTime" :value="serviceAgeIndex" :range="serviceAges">
  227. <view class="picker-text">{{ serviceYear || '请选择服务年限类型 >' }}</view>
  228. </picker>
  229. </view>
  230. <view class="form-item">
  231. <text class="labels">*</text>
  232. <text class="label">付款时间</text>
  233. <uni-datetime-picker type="datetime" v-model="clientInfo.appOrderVoucherList[0].payTime" :clearIcon="false" :border="false">
  234. </uni-datetime-picker>
  235. </view>
  236. <view class="con_size">
  237. <text class="labels">*</text>
  238. <text class="label">支付凭证</text>
  239. <uv-upload
  240. :fileList="fileList1"
  241. name="1"
  242. multiple
  243. :maxCount="1"
  244. @afterRead="afterRead"
  245. @delete="deletePic"
  246. ><image
  247. src="/static/image/组件 5 – 1.png"
  248. mode="widthFix"
  249. style="width: 100px;height: 150px;"
  250. ></image></uv-upload>
  251. </view>
  252. <view class="con_size">
  253. <text class="labels">*</text>
  254. <text class="label">发票信息 </text>
  255. <uv-upload
  256. :fileList="fileList2"
  257. name="2"
  258. multiple
  259. :maxCount="1"
  260. @afterRead="afterRead"
  261. @delete="deletePic"
  262. ><image
  263. src="/static/image/组件 5 – 1.png"
  264. mode="widthFix"
  265. style="width: 100px;height: 150px;"
  266. ></image></uv-upload>
  267. </view>
  268. </view>
  269. <!-- 金融信息 -->
  270. <view class="section">
  271. <view class="con_size">
  272. <image src="/static/image/矩形 5315.png" class='con_size_img' ></image>金融信息</view>
  273. <view class="form-item">
  274. <text class="label">贷款机构</text>
  275. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderFinanceList[0].lender" placeholder="请输入贷款机构" />
  276. </view>
  277. <view class="form-item">
  278. <text class="label">贷款金额</text>
  279. <textarea auto-height :adjust-position="true" class="input" v-model="clientInfo.appOrderFinanceList[0].lenderMoney" placeholder="请输入贷款金额" />
  280. </view>
  281. <view class="form-item">
  282. <text class="label">贷款期限</text>
  283. <textarea :adjust-position="true" class="input" v-model="clientInfo.appOrderFinanceList[0].lenderYear" placeholder="请输入贷款期限" />
  284. </view>
  285. </view>
  286. <view class="sections">
  287. <view class="form-button">
  288. <button class=" button" @click="get_to" style="width: 60%;">提交去录单</button>
  289. </view>
  290. </view>
  291. </view>
  292. </template>
  293. <script>
  294. import {idCardInfo,carCert,upload,getChildListBatch,add,isToken,queryDictItemsByCode} from '@/api.uts'
  295. export default {
  296. data() {
  297. return {
  298. uploadConfig:{
  299. // 上传地址
  300. url:'https://gpt.aiym.run/contract/miniapp/file/upload',
  301. // 文件字段名
  302. name: 'file',
  303. // 请求头
  304. header: {},
  305. // 附带的表单数据
  306. formData: {
  307. 'biz': 'cert'
  308. },
  309. // 是否开启实际上传
  310. enabled: true
  311. },
  312. clientInfo: {
  313. appOrderCarList: [
  314. {
  315. buyMoney: 0,
  316. buyTax: 0,
  317. buyTime: null,
  318. carModel: "",
  319. carNo: "",
  320. carSeries: "",
  321. carType: "",
  322. engineNo: "",
  323. mileage: "",
  324. newCar: 0,
  325. useType: "",
  326. vin: ""
  327. }
  328. ],
  329. appOrderFinanceList: [
  330. {
  331. lender: "",
  332. lenderMone: 0,
  333. lenderYear: "",
  334. lenderMoney:""
  335. }
  336. ],
  337. appOrderVoucherList: [
  338. {
  339. dealerAddress: "",
  340. effectiveTime: null,
  341. endTime: null,
  342. firstBeneficiary: "",
  343. packageMoney: 0,
  344. payTime: "",
  345. serviceMoney: 0,
  346. serviceYear: ""
  347. }
  348. ],
  349. carPic: "",
  350. certBack: "",
  351. certFront: "",
  352. custAddress: "",
  353. custCardNo: "",
  354. custName: "",
  355. custPhone: "",
  356. custType: 0,
  357. invoiceUrl:"",
  358. payType: '全款', // 默认选中全款
  359. payVoucherUrl: "",
  360. payee: "",
  361. productName: "自动填写所选商品服务分类",
  362. productServiceYear: 1,
  363. saleName: "",
  364. salePort: ''||"售前",
  365. status: 0,
  366. storeName: "自动填写所选择的门店"
  367. },
  368. keyboardHeight:0,
  369. fileList1:[],
  370. fileList2:[],
  371. departments: ['售前', '售后', '二网车'],
  372. carType : ['燃油车','新能源'],
  373. useType : ['非营运','营运'],
  374. serviceYear:'',
  375. isTrue:false,
  376. carBrandIndex: -1,
  377. useTypeIndex: -1,
  378. serviceAges: [],
  379. serviceAgeIndex: -1,
  380. payees: [],
  381. payeeIndex: -1,
  382. screenHeight: 0, //屏幕可视高度
  383. curHeight: 0, //页面需要的动态高
  384. // 扫描
  385. positiveImg: '/static/image/组件 4 – 1.png',//自己图片路径
  386. certFront:'',
  387. carPic:'',
  388. certBack:'',
  389. // 反面身份证
  390. reverseImg: '/static/image/组 71663.png', //自己图片路径
  391. // 行车驾驶证
  392. carImg: '/static/image/组件 2 – 1.png' //自己图片路径
  393. }
  394. },
  395. onLoad(options) {
  396. isToken();
  397. this.clientInfo.storeName = getApp().storeName || "自动填写所选择的门店";
  398. this.clientInfo.productName = getApp().productName || "自动填写所选商品服务分类";
  399. this.clientInfo.appOrderVoucherList[0].dealerAddress = getApp().dealerAddress;
  400. this.clientInfo.productContractTemp = getApp().productUrl;
  401. for (var index = 0; index < getApp().allMsg.length; index++) {
  402. this.payees.push(getApp().allMsg[index].storeName);
  403. }
  404. this.clientInfo.payee = getApp().storeName;
  405. this.uploadConfig.header = {
  406. 'X-Access-Token':uni.getStorageSync('token')
  407. }
  408. queryDictItemsByCode({code:"service_year"}).then((res)=>{
  409. console.log(res);
  410. for (var i = 0; i < res.length; i++) {
  411. this.serviceAges.unshift(res[i].text)
  412. }
  413. })
  414. let clientInfo = JSON.parse(decodeURIComponent(options.clientInfo));
  415. // console.log('5',clientInfo)
  416. if(clientInfo){
  417. this.clientInfo= JSON.parse(decodeURIComponent(options.clientInfo))
  418. this.certFront = getApp().certFront;
  419. this.carPic =getApp().carPic;
  420. this.certBack = getApp().certBack;
  421. // console.log('111',this.certFront ,this.carPic,this.certBack)
  422. }
  423. },
  424. onUpload() {
  425. // 页面销毁时移除监听
  426. uni.offKeyboardHeightChange();
  427. },
  428. methods: {
  429. isEmpty(value) {
  430. if (value === null || value === undefined ) return false;
  431. if (typeof value === "string" && value.trim() === "") return false;
  432. if (Array.isArray(value) && value.length === 0) return false;
  433. if (typeof value === "object" && Object.keys(value).length === 0) return false;
  434. return true;
  435. },
  436. handleFocus() {
  437. uni.onKeyboardHeightChange(res => {
  438. this.keyboardHeight = res.height;
  439. });
  440. },
  441. // 凭证上传函数
  442. deletePic(event) {
  443. this[`fileList${event.name}`].splice(event.index, 1)
  444. },
  445. // 新增图片
  446. async afterRead(event) {
  447. // console.log(event);
  448. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  449. let lists = [].concat(event.file)
  450. let fileListLen = this[`fileList${event.name}`].length
  451. lists.map((item) => {
  452. this[`fileList${event.name}`].push({
  453. ...item,
  454. status: 'uploading',
  455. message: '上传中'
  456. })
  457. })
  458. for (let i = 0; i < lists.length; i++) {
  459. const result = await this.uploadFilePromise(lists[i].url,event.name)
  460. let item = this[`fileList${event.name}`][fileListLen]
  461. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  462. status: 'success',
  463. message: '',
  464. url: result
  465. }))
  466. fileListLen++
  467. }
  468. },
  469. uploadFilePromise(url,name) {
  470. let token = uni.getStorageSync('token')
  471. return new Promise((resolve, reject) => {
  472. let a = uni.uploadFile({
  473. url: 'https://www.shengchuangyunkong.com/contract/miniapp/file/upload', // 仅为示例,非真实的接口地址
  474. filePath: url,
  475. name: 'file',
  476. formData: {
  477. biz: 'test'
  478. },
  479. header:{
  480. 'X-Access-Token':token
  481. },
  482. success: (res) => {
  483. if(name == '1'){
  484. this.clientInfo.payVoucherUrl = JSON.parse(res.data).message;
  485. setTimeout(() => {
  486. resolve(res.data.data)
  487. }, 1000)
  488. }else{
  489. this.clientInfo.invoiceUrl = JSON.parse(res.data).message;
  490. setTimeout(() => {
  491. resolve(res.data.data)
  492. }, 1000)
  493. }
  494. }
  495. });
  496. })
  497. },
  498. get_to(){
  499. console.log('suss', JSON.parse(JSON.stringify(this.clientInfo) ));
  500. for (var i in this.clientInfo) {
  501. if (typeof this.clientInfo[i] == 'object') {
  502. for (var j in this.clientInfo[i]) {
  503. if(!this.isEmpty(this.clientInfo[i][j])&& j!="carNo"&&j!="lender"&&j!="lenderMoney"&&j!="lenderYear"){
  504. uni.showToast({
  505. title: "提交失败,请检查字段是否未填!",
  506. icon: 'error',
  507. duration: 500,
  508. success: (res) => {
  509. },
  510. fail: (res) => {
  511. },
  512. });
  513. return false
  514. }
  515. }
  516. }else{
  517. if(!this.isEmpty(this.clientInfo[i])){
  518. uni.showToast({
  519. title: "提交失败,请检查字段是否未填!",
  520. icon: 'error',
  521. duration: 500,
  522. success: (res) => {
  523. },
  524. fail: (res) => {
  525. },
  526. });
  527. return false
  528. }
  529. }
  530. }
  531. add(this.clientInfo).then((res)=>{
  532. if(res.success){
  533. uni.showToast({
  534. title: "提交成功",
  535. icon: 'success',
  536. duration: 500,
  537. success: (res) => {
  538. },
  539. fail: (res) => {
  540. },
  541. });
  542. uni.switchTab (
  543. { url: '/pages/index/dingdan' }
  544. )
  545. }else{
  546. uni.showToast({
  547. title: "提交失败,请检查格式!",
  548. icon: 'error',
  549. duration: 500,
  550. success: (res) => {
  551. },
  552. fail: (res) => {
  553. },
  554. });
  555. }
  556. }).catch((err)=>{
  557. console.log('err',err);
  558. })
  559. },
  560. getCar(){
  561. getApp().flag = 0;
  562. uni.navigateTo(
  563. {
  564. url: '/pages/views/carOne?clientInfo=' + encodeURIComponent(JSON.stringify(this.clientInfo))
  565. }
  566. )
  567. getApp().certFront = this.certFront;
  568. getApp().carPic = this.carPic;
  569. getApp().certBack =this.certBack;
  570. },
  571. toBack(){
  572. uni.redirectTo(
  573. {
  574. url: '/pages/views/dingDanCreate'
  575. }
  576. )
  577. },
  578. handleDepartmentChange(e) {
  579. this.clientInfo.salePort = e;
  580. },
  581. // 修改车辆类型
  582. bindCarBrandChanges(e){
  583. this.clientInfo.appOrderCarList[0].carType = this.carType[e.detail.value];
  584. },
  585. // serviceYearChanges(e){
  586. // this.clientInfo.appOrderVoucherList[0].serviceYear = this.serviceAges[e.detail.value]
  587. // this.serviceYear = this.serviceAges[e.detail.value]
  588. // console.log(e.detail.value )
  589. // },
  590. // 修改车辆类型
  591. binduseTypeChanges(e){
  592. this.clientInfo.appOrderCarList[0].useType = this.useType[e.detail.value];
  593. },
  594. // // 取服务年限
  595. // bindServiceAgeChange(e) {
  596. // this.serviceAgeIndex = e.detail.value
  597. // if(this.serviceAges[e.detail.value] == '1年'){
  598. // this.clientInfo.productServiceYear = 1;
  599. // }else if(this.serviceAges[e.detail.value] == '2年' ){
  600. // this.clientInfo.productServiceYear = 2;
  601. // }else{
  602. // this.clientInfo.productServiceYear = 3;
  603. // };
  604. // },
  605. // 选择收款方
  606. bindPayeeChange(e) {
  607. this.payeeIndex = e.detail.value
  608. this.clientInfo.payee= this.payees[e.detail.value];
  609. },
  610. msToDate (msec) {
  611. let datetime = new Date(msec);
  612. let year = datetime.getFullYear();
  613. let month = datetime.getMonth();
  614. let date = datetime.getDate();
  615. let hour = datetime.getHours();
  616. let minute = datetime.getMinutes();
  617. let second = datetime.getSeconds();
  618. let result1 = year +
  619. '-' +
  620. ((month + 1) >= 10 ? (month + 1) : '0' + (month + 1)) +
  621. '-' +
  622. ((date + 1) < 10 ? '0' + date : date) +
  623. ' ' +
  624. ((hour + 1) < 10 ? '0' + hour : hour) +
  625. ':' +
  626. ((minute + 1) < 10 ? '0' + minute : minute) +
  627. ':' +
  628. ((second + 1) < 10 ? '0' + second : second);
  629. let result2 = year +
  630. '-' +
  631. ((month + 1) >= 10 ? (month + 1) : '0' + (month + 1)) +
  632. '-' +
  633. ((date + 1) < 10 ? '0' + date : date);
  634. let result = {
  635. hasTime: result1,
  636. withoutTime: result2
  637. };
  638. return result;
  639. },
  640. // 修改生效时间
  641. changeEffectiveTime(e){
  642. var dateTime = new Date(e);
  643. dateTime.setDate(dateTime.getDate() + 2);
  644. dateTime = new Date(dateTime);
  645. // console.log(this.msToDate(dateTime).withoutTime);
  646. this.clientInfo.appOrderVoucherList[0].effectiveTime = this.msToDate(dateTime).withoutTime
  647. },
  648. changeTime(e){
  649. console.log(e.detail.value)
  650. if(this.clientInfo.appOrderVoucherList[0].effectiveTime){
  651. this.clientInfo.appOrderVoucherList[0].serviceYear = this.serviceAges[e.detail.value]
  652. this.serviceYear = this.serviceAges[e.detail.value]
  653. var dateTime = new Date(this.clientInfo.appOrderVoucherList[0].effectiveTime);
  654. let year = Number(dateTime.getFullYear()) + Number(e.detail.value) +1;
  655. dateTime.setFullYear(year);
  656. dateTime = new Date(dateTime);
  657. // console.log(this.msToDate(dateTime).withoutTime);
  658. this.clientInfo.appOrderVoucherList[0].endTime = this.msToDate(dateTime).withoutTime
  659. }else{
  660. uni.showToast({
  661. title: "请先选择生效时间!",
  662. icon: 'error',
  663. duration: 500,
  664. success: (res) => {
  665. },
  666. fail: (res) => {
  667. },
  668. })
  669. }
  670. },
  671. changebuyTax(){
  672. this.clientInfo.appOrderCarList[0].buyTax = (this.clientInfo.appOrderCarList[0].buyMoney/11.3).toFixed(2)
  673. },
  674. // 身份证正面上传
  675. uploadPositive() {
  676. uni.chooseImage({
  677. count: 1,
  678. sizeType: ['original', 'compressed'],
  679. sourceType: ['album', 'camera'],
  680. success: (res) => {
  681. let filePath = res.tempFilePaths[0];
  682. let token = uni.getStorageSync('token');
  683. this.uploadIdentify(token,'front',filePath,'sfz');
  684. }
  685. })
  686. },
  687. // 身份证反面上传
  688. uploadReverse() {
  689. uni.chooseImage({
  690. count: 1,
  691. sizeType: ['original', 'compressed'],
  692. sourceType: ['album', 'camera'],
  693. success: (res) => {
  694. let filePath = res.tempFilePaths[0];
  695. let token = uni.getStorageSync('token');
  696. this.uploadIdentify(token,'back',filePath,'sfz')
  697. }
  698. })
  699. },
  700. uploadCarCert() {
  701. uni.chooseImage({
  702. count: 1,
  703. sizeType: ['original', 'compressed'],
  704. sourceType: ['album', 'camera'],
  705. success: (res) => {
  706. let filePath = res.tempFilePaths[0];
  707. let token = uni.getStorageSync('token');
  708. this.uploadIdentify(token,'',filePath,'carCert')
  709. }
  710. })
  711. },
  712. // 上传识别
  713. uploadIdentify(token,side,filePath,type) {
  714. uni.uploadFile({
  715. url: 'https://www.shengchuangyunkong.com/contract/miniapp/file/upload', //仅为示例,非真实的接口地址
  716. filePath:filePath,
  717. name: 'file',
  718. formData: {
  719. 'biz': 'cert'
  720. },
  721. header:{
  722. 'X-Access-Token':token
  723. },
  724. success: (res) => {
  725. let image = JSON.parse(res.data).message;
  726. // console.log(image);
  727. if(type == "sfz"){
  728. idCardInfo({'side':side,'url':JSON.parse(res.data).message}).then((res)=>{
  729. if(res.success){
  730. if(side == 'front'){
  731. this.clientInfo.custName =res.result.name;
  732. this.clientInfo.appOrderVoucherList[0].firstBeneficiary = res.result.name;
  733. this.clientInfo.custAddress= res.result.address;
  734. this.clientInfo.custCardNo = res.result.idCard ;
  735. this.clientInfo.certFront = image;
  736. this.certFront=filePath;
  737. }else {
  738. this.clientInfo.certBack=image;
  739. this.certBack=filePath;
  740. }
  741. }else{
  742. uni.showToast({
  743. title: "身份证识别错误,请重新上传!",
  744. icon: 'error',
  745. duration: 500,
  746. success: (res) => {
  747. },
  748. fail: (res) => {
  749. },
  750. })
  751. }
  752. }).catch(err => {
  753. console.log("catch: ", err);
  754. })
  755. }else if(type == 'carCert' ){
  756. // 处理车辆信息
  757. carCert({'url':JSON.parse(res.data).message}).then((res)=>{
  758. if(res.success){
  759. // 车架号
  760. this.clientInfo.appOrderCarList[0].vin = res.result.VinNo;
  761. this.clientInfo.carPic = image;
  762. this.carPic = filePath;
  763. // 发动机号
  764. this.clientInfo.appOrderCarList[0].engineNo = res.result.EngineNo;
  765. // 车辆型号
  766. this.clientInfo.appOrderCarList[0].carModel = res.result.CarModel;
  767. }else{
  768. uni.showToast({
  769. title: "识别错误,请重新上传!",
  770. icon: 'error',
  771. duration: 500,
  772. success: (res) => {
  773. },
  774. fail: (res) => {
  775. },
  776. })
  777. }
  778. }).catch((err)=>{
  779. console.log("catch: ", err);
  780. })
  781. }
  782. },
  783. fail:(err)=>{
  784. console.log(err)
  785. }
  786. });
  787. },
  788. onChange(e){
  789. // console.log(e);
  790. if(e == '个人'){
  791. this.clientInfo.custType = 0;
  792. }else{
  793. this.clientInfo.custType = 1;
  794. }
  795. },
  796. onChanges(e){
  797. if(e == '是'){
  798. this.clientInfo.appOrderCarList[0].newCar = 1;
  799. }else{
  800. this.clientInfo.appOrderCarList[0].newCar = 0;
  801. }
  802. }
  803. }
  804. }
  805. </script>
  806. <style scoped lang="scss">
  807. .containers {
  808. height: 100vh;
  809. width: 100%;
  810. background-color: #fff;
  811. overflow-y:scroll;
  812. }
  813. .footer {
  814. position: fixed;
  815. bottom: 0;
  816. left: 0;
  817. }
  818. .container::-webkit-scrollbar {
  819. display: none;
  820. }
  821. .section {
  822. // margin-bottom: 30rpx;
  823. border-bottom: 1rpx solid #eee;
  824. margin: 0 1rem 0 1rem;
  825. }
  826. .sections{
  827. margin: 0 1rem 1rem 1rem;
  828. }
  829. .form-item {
  830. display: flex;
  831. flex-direction: row;
  832. justify-content: space-between;
  833. align-items: center;
  834. padding: 0.5rem 0;
  835. border-bottom: 0.1rem solid #f2f2f2;
  836. color: #767676;
  837. flex-grow:1;
  838. overflow-y:auto
  839. }
  840. .labels{
  841. color: red;
  842. display: flex;
  843. justify-content: center;
  844. align-items: center;
  845. }
  846. .label {
  847. font-size: 28rpx;
  848. color: #666;
  849. width: 200rpx;
  850. }
  851. .input {
  852. flex: 1;
  853. text-align: right;
  854. font-size: 28rpx;
  855. color: #737373;
  856. height: 100%;
  857. }
  858. .picker {
  859. flex: 1;
  860. }
  861. .picker-text {
  862. text-align: right;
  863. color: #737373;
  864. font-size: 0.8rem;
  865. }
  866. .radio-group {
  867. display: flex;
  868. flex: 1;
  869. justify-content: flex-end;
  870. flex-direction: row;
  871. }
  872. .radio-label {
  873. padding: 0;
  874. margin-left: 10rpx;
  875. display: flex;
  876. flex-direction: row;
  877. font-size: 1rem;
  878. transform: scale(0.7);
  879. }
  880. .value {
  881. flex: 1;
  882. text-align: right;
  883. color: #737373;
  884. font-size: 0.8rem;
  885. }
  886. // .timePiker{
  887. // display: flex;
  888. // justify-content: center;
  889. // align-items: center;
  890. // color: #3f3f3f;
  891. // }
  892. .idCard-box {
  893. margin-top: 10%;
  894. width: 100%;
  895. height: 50%;
  896. display: flex;
  897. flex-direction: row;
  898. /* background-color: red; */
  899. flex-wrap: wrap;
  900. .reverse {
  901. height: 30%;
  902. width: 40%;
  903. display: flex;
  904. align-items: center;
  905. justify-content: center;
  906. // background-color: blue;
  907. margin: 0 5% 0 5%;
  908. image {
  909. width: 100%;
  910. height: 100%;
  911. }
  912. text{
  913. position: absolute;
  914. text-shadow: 1px 1px black, -1px -1px black, 1px -1px black, -1px 1px black;
  915. font-size: 0.8rem;
  916. color:#fff;
  917. }
  918. }
  919. }
  920. /* 表单分区样式 */
  921. .con_size {
  922. font-size: 1rem;
  923. font-weight: bold;
  924. margin: 1rem 0;
  925. color: #000000;
  926. display: flex;
  927. flex-direction: row;
  928. align-items: center;
  929. }
  930. .con_size_img{
  931. height: 100%;
  932. width: 2%;
  933. margin-right: 2%;
  934. }
  935. .form-button{
  936. width: 100%;
  937. height:100%;
  938. // background-color: #000000;
  939. display: flex;
  940. align-items: center;
  941. justify-content: center;
  942. }
  943. .button{
  944. height: 100%;
  945. width: 100%;
  946. background-color: #044f7a;
  947. color: #ffffff;
  948. border-radius: 1rem;
  949. }
  950. </style>