合同小程序前端代码仓库
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.

585 lines
16 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months 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.paymentMethod === '全款'" 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">
  41. <image :src="clientInfo.certFront == ''?positiveImg:clientInfo.certFront" @tap.prevent="uploadPositive">
  42. </image>
  43. </view>
  44. <view class="reverse">
  45. <image :src="clientInfo.certBack == ''?reverseImg:clientInfo.certBack" @tap.prevent="uploadReverse">
  46. </image>
  47. </view>
  48. <view class="reverse">
  49. <image :src="clientInfo.carPic == ''?carImg:clientInfo.carPic" @tap.prevent="uploadReverse">
  50. </image>
  51. </view>
  52. </view>
  53. <!-- 客户基本信息 -->
  54. <view class="section">
  55. <view class="con_size">
  56. <image src="/static/image/矩形 5315.png" class='con_size_img' ></image>
  57. 客户基本信息
  58. </view>
  59. <view class="form-item">
  60. <text class="labels">*</text>
  61. <text class="label">产品名称</text>
  62. <text class="value">{{ clientInfo.productName }}</text>
  63. </view>
  64. <view class="form-item">
  65. <text class="labels">*</text>
  66. <text class="label">经销商</text>
  67. <text class="value">{{ clientInfo.storeName }}</text>
  68. </view>
  69. <view class="form-item">
  70. <text class="labels">*</text>
  71. <text class="label">客户姓名</text>
  72. <input class="input" v-model="clientInfo.custName" placeholder="请输入客户姓名" />
  73. </view>
  74. <view class="form-item">
  75. <text class="labels">*</text>
  76. <text class="label">居住地址</text>
  77. <input class="input" v-model="clientInfo.custAddress" placeholder="请输入居住地址" />
  78. </view>
  79. <view class="form-item">
  80. <text class="labels">*</text>
  81. <text class="label">身份证号码</text>
  82. <input class="input" v-model="clientInfo.custCardNo" placeholder="请输入身份证号码" />
  83. </view>
  84. <view class="form-item">
  85. <text class="labels">*</text>
  86. <text class="label">联系方式</text>
  87. <input class="input" v-model="clientInfo.custPhone" placeholder="请输入联系方式" />
  88. </view>
  89. <view class="form-item">
  90. <text class="labels">*</text>
  91. <text class="label">销售端口</text>
  92. <l-radio-group class="radio-group" @change="handleDepartmentChange">
  93. <label class="radio-label" v-for="item in departments" :key="item">
  94. <l-radio :value="item" :checked="clientInfo.salePort === item" >
  95. <template #icon="{checked}">
  96. <image v-show="checked" style="width:1.2rem; height:1.2rem;" src="/static/image/xuanzhong.png"></image>
  97. <image v-show="!checked" style="width:1.2rem; height:1.2rem" src="/static/image/weixuanzhong.png"></image>
  98. </template>
  99. </l-radio>
  100. <text style="margin-left:0.2rem;">{{ item }}</text>
  101. </label>
  102. </l-radio-group>
  103. </view>
  104. <view class="form-item">
  105. <text class="labels">*</text>
  106. <text class="label">促销销售顾问</text>
  107. <input class="input" v-model="clientInfo.saleName" placeholder="请输入店铺销售顾问" />
  108. </view>
  109. </view>
  110. <!-- 车辆信息 -->
  111. <view class="section">
  112. <view class="con_size">
  113. <image src="/static/image/矩形 5315.png" class='con_size_img' ></image>车辆信息</view>
  114. <view class="form-item">
  115. <text class="labels">*</text>
  116. <text class="label">车牌车系</text>
  117. <picker class="picker" @change="bindCarBrandChange" :value="carBrandIndex" :range="carBrands">
  118. <view class="picker-text">{{ carBrands[carBrandIndex] || '请选择车辆品牌 >' }}</view>
  119. </picker>
  120. </view>
  121. <view class="form-item">
  122. <text class="labels">*</text>
  123. <text class="label">车架号</text>
  124. <input class="input" v-model="clientInfo.vin" placeholder="请填写车架号" />
  125. </view>
  126. </view>
  127. <!-- 产品描述 -->
  128. <view class="section">
  129. <view class="con_size">
  130. <image src="/static/image/矩形 5315.png" class='con_size_img' ></image>产品信息</view>
  131. <view class="form-item">
  132. <text class="labels">*</text>
  133. <text class="label">产品名称</text>
  134. <text class="value">{{ clientInfo.productName }}</text>
  135. </view>
  136. <view class="form-item">
  137. <text class="labels">*</text>
  138. <text class="label">服务年龄</text>
  139. <picker class="picker" @change="bindServiceAgeChange" :value="serviceAgeIndex" :range="serviceAges">
  140. <view class="picker-text">{{ serviceAges[serviceAgeIndex] || '请选择服务年限 >' }}</view>
  141. </picker>
  142. </view>
  143. <view class="form-item">
  144. <text class="labels">*</text>
  145. <text class="label">销售金额</text>
  146. <input class="input" v-model="clientInfo.productMoney" placeholder="请输入销售金额" />
  147. </view>
  148. </view>
  149. <!-- 付款信息 -->
  150. <view class="section">
  151. <view class="con_size">
  152. <image src="/static/image/矩形 5315.png" class='con_size_img' ></image>付款信息</view>
  153. <view class="form-item">
  154. <text class="labels">*</text>
  155. <text class="label">收款方</text>
  156. <picker class="picker" @change="bindPayeeChange" :value="payeeIndex" :range="payees">
  157. <view class="picker-text">{{ payees[payeeIndex] || '请选择收款方 >' }}</view>
  158. </picker>
  159. </view>
  160. <view class="form-item">
  161. <text class="labels">*</text>
  162. <text class="label">付款时间</text>
  163. <uni-datetime-picker type="datetime" v-model="clientInfo.payeeTime" :clearIcon="false" :border="false">
  164. </uni-datetime-picker>
  165. </view>
  166. <view class="con_size">
  167. <text class="labels">*</text>
  168. <text class="label">支付凭证</text>
  169. <uv-upload
  170. :fileList="fileList1"
  171. name="1"
  172. multiple
  173. :maxCount="1"
  174. @afterRead="afterRead"
  175. @delete="deletePic"
  176. ><image
  177. src="/static/image/组件 5 – 1.png"
  178. mode="widthFix"
  179. style="width: 100px;height: 150px;"
  180. ></image></uv-upload>
  181. </view>
  182. </view>
  183. <view class="sections">
  184. <view class="form-button">
  185. <button class=" button" @click="get_to" style="width: 60%;">提交去录单</button>
  186. </view>
  187. </view>
  188. </view>
  189. </template>
  190. <script>
  191. import {idCardInfo,upload,getChildListBatch,add} from '@/api.uts'
  192. export default {
  193. data() {
  194. return {
  195. uploadConfig:{
  196. // 上传地址
  197. url:'https://gpt.aiym.run/contract/miniapp/file/upload',
  198. // 文件字段名
  199. name: 'file',
  200. // 请求头
  201. header: {},
  202. // 附带的表单数据
  203. formData: {
  204. 'biz': 'cert'
  205. },
  206. // 是否开启实际上传
  207. enabled: true
  208. },
  209. clientInfo: {
  210. paymentMethod: '全款', // 默认选中全款
  211. productName: "自动填写所选商品服务分类",
  212. storeName: "自动填写所选择的门店",
  213. custName:"",
  214. custAddress:'',
  215. custCardNo:"",
  216. custPhone: '',
  217. salePort: ''||"售前",
  218. saleName: '',
  219. productServiceYear:'',
  220. payeeTime:"",
  221. certFront:'',
  222. certBack:'',
  223. carPic:'',
  224. productMoney: null,
  225. payee:'',
  226. payVoucherUrl:'',
  227. custType:0,
  228. vin: ''
  229. },
  230. fileList1:[],
  231. departments: ['售前', '售后', '二网车'],
  232. carBrands: [],
  233. carBrandIndex: -1,
  234. serviceAges: ['1年', '2年', '3年'],
  235. serviceAgeIndex: -1,
  236. payees: ['收款方A', '收款方B', '收款方C'],
  237. payeeIndex: -1,
  238. // 扫描
  239. positiveImg: '/static/image/组件 4 – 1.png',//自己图片路径
  240. // 反面身份证
  241. reverseImg: '/static/image/组 71663.png', //自己图片路径
  242. // 行车驾驶证
  243. carImg: '/static/image/组件 2 – 1.png' //自己图片路径
  244. }
  245. },
  246. mounted() {
  247. this.clientInfo.storeName = getApp().storeName || "自动填写所选择的门店";
  248. this.clientInfo.productName = getApp().productName || "自动填写所选商品服务分类";
  249. this.uploadConfig.header = {
  250. 'X-Access-Token':uni.getStorageSync('token')
  251. }
  252. getChildListBatch().then((res)=>{
  253. console.log(res.result.records)
  254. this.carBrands = [];
  255. for (var index = 0; index < res.result.records.length; index++) {
  256. this.carBrands.push(res.result.records[index].name);
  257. }
  258. })
  259. },
  260. methods: {
  261. // 凭证上传函数
  262. deletePic(event) {
  263. this[`fileList${event.name}`].splice(event.index, 1)
  264. },
  265. // 新增图片
  266. async afterRead(event) {
  267. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  268. let lists = [].concat(event.file)
  269. let fileListLen = this[`fileList${event.name}`].length
  270. lists.map((item) => {
  271. this[`fileList${event.name}`].push({
  272. ...item,
  273. status: 'uploading',
  274. message: '上传中'
  275. })
  276. })
  277. for (let i = 0; i < lists.length; i++) {
  278. const result = await this.uploadFilePromise(lists[i].url)
  279. let item = this[`fileList${event.name}`][fileListLen]
  280. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  281. status: 'success',
  282. message: '',
  283. url: result
  284. }))
  285. fileListLen++
  286. }
  287. },
  288. uploadFilePromise(url) {
  289. let token = uni.getStorageSync('token')
  290. return new Promise((resolve, reject) => {
  291. let a = uni.uploadFile({
  292. url: 'https://gpt.aiym.run/contract/miniapp/file/upload', // 仅为示例,非真实的接口地址
  293. filePath: url,
  294. name: 'file',
  295. formData: {
  296. biz: 'test'
  297. },
  298. header:{
  299. 'X-Access-Token':token
  300. },
  301. success: (res) => {
  302. this.clientInfo.payVoucherUrl = JSON.parse(res.data).message;
  303. setTimeout(() => {
  304. resolve(res.data.data)
  305. }, 1000)
  306. }
  307. });
  308. })
  309. },
  310. get_to(){
  311. add(this.clientInfo).then((res)=>{
  312. console.log(res)
  313. })
  314. // uni.switchTab (
  315. // { url: '/pages/index/dingdan' }
  316. // )
  317. },
  318. toBack(){
  319. let canNavBack = getCurrentPages()
  320. if( canNavBack && canNavBack.length>1) {
  321. uni.navigateBack()
  322. } else {
  323. history.back();
  324. }
  325. },
  326. handleDepartmentChange(e) {
  327. this.clientInfo.salePort = e;
  328. },
  329. // 修改车辆品牌
  330. bindCarBrandChange(e) {
  331. this.carBrandIndex = e.detail.value
  332. },
  333. // 取服务年限
  334. bindServiceAgeChange(e) {
  335. this.serviceAgeIndex = e.detail.value
  336. this.clientInfo.productServiceYear = this.serviceAges[e.detail.value];
  337. },
  338. // 选择收款方
  339. bindPayeeChange(e) {
  340. this.payeeIndex = e.detail.value
  341. this.clientInfo.payee= this.payees[e.detail.value];
  342. },
  343. // 身份证正面上传
  344. uploadPositive() {
  345. uni.chooseImage({
  346. count: 1,
  347. sizeType: ['original', 'compressed'],
  348. sourceType: ['album', 'camera'],
  349. success: (res) => {
  350. let filePath = res.tempFilePaths[0];
  351. let token = uni.getStorageSync('token');
  352. this.uploadIdentify(token,'front',filePath);
  353. }
  354. })
  355. },
  356. // 身份证反面上传
  357. uploadReverse() {
  358. uni.chooseImage({
  359. count: 1,
  360. sizeType: ['original', 'compressed'],
  361. sourceType: ['album', 'camera'],
  362. success: (res) => {
  363. let filePath = res.tempFilePaths[0];
  364. let token = uni.getStorageSync('token');
  365. this.uploadIdentify(token,'back',filePath)
  366. }
  367. })
  368. },
  369. // 上传识别
  370. uploadIdentify(token,side,filePath) {
  371. uni.uploadFile({
  372. url: 'https://gpt.aiym.run/contract/miniapp/file/upload', //仅为示例,非真实的接口地址
  373. filePath:filePath,
  374. name: 'file',
  375. formData: {
  376. 'biz': 'cert'
  377. },
  378. header:{
  379. 'X-Access-Token':token
  380. },
  381. success: (res) => {
  382. idCardInfo({'side':side,'url':JSON.parse(res.data).message}).then((res)=>{
  383. console.log('res',res);
  384. if(res.success){
  385. if(side == 'front'){
  386. this.clientInfo.custName =res.result.name;
  387. this.clientInfo.custAddress= res.result.address;
  388. this.clientInfo.custCardNo = res.result.idCard ;
  389. this.clientInfo.certFront = filePath;
  390. }else {
  391. this.clientInfo.certBack=filePath;
  392. }
  393. }else{
  394. uni.showToast({
  395. title: "身份证识别错误,请重新上传!",
  396. icon: 'error',
  397. duration: 500,
  398. success: (res) => {
  399. },
  400. fail: (res) => {
  401. },
  402. })
  403. }
  404. }).catch(err => {
  405. console.log("catch: ", err);
  406. })
  407. },
  408. fail:(err)=>{
  409. console.log(err)
  410. }
  411. });
  412. },
  413. onChange(e){
  414. console.log("e",e);
  415. if(e = '个人'){
  416. this.clientInfo.custType = 0;
  417. }else{
  418. this.clientInfo.custType = 1;
  419. }
  420. }
  421. }
  422. }
  423. </script>
  424. <style scoped lang="scss">
  425. .containers {
  426. height: 100%;
  427. width: 100%;
  428. background-color: #fff;
  429. overflow-y:scroll;
  430. }
  431. .container::-webkit-scrollbar {
  432. display: none;
  433. }
  434. .section {
  435. // margin-bottom: 30rpx;
  436. border-bottom: 1rpx solid #eee;
  437. margin: 0 1rem 0 1rem;
  438. }
  439. .sections{
  440. margin: 0 1rem 1rem 1rem;
  441. }
  442. .form-item {
  443. display: flex;
  444. flex-direction: row;
  445. justify-content: space-between;
  446. align-items: center;
  447. padding: 0.5rem 0;
  448. border-bottom: 0.1rem solid #f2f2f2;
  449. color: #767676;
  450. }
  451. .labels{
  452. color: red;
  453. display: flex;
  454. justify-content: center;
  455. align-items: center;
  456. }
  457. .label {
  458. font-size: 28rpx;
  459. color: #666;
  460. width: 200rpx;
  461. }
  462. .input {
  463. flex: 1;
  464. text-align: right;
  465. font-size: 28rpx;
  466. color: #737373;
  467. }
  468. .picker {
  469. flex: 1;
  470. }
  471. .picker-text {
  472. text-align: right;
  473. color: #737373;
  474. font-size: 0.8rem;
  475. }
  476. .radio-group {
  477. display: flex;
  478. flex: 1;
  479. justify-content: flex-end;
  480. flex-direction: row;
  481. }
  482. .radio-label {
  483. padding: 0;
  484. margin-left: 10rpx;
  485. display: flex;
  486. flex-direction: row;
  487. font-size: 1rem;
  488. transform: scale(0.7);
  489. }
  490. .value {
  491. flex: 1;
  492. text-align: right;
  493. color: #737373;
  494. font-size: 0.8rem;
  495. }
  496. // .timePiker{
  497. // display: flex;
  498. // justify-content: center;
  499. // align-items: center;
  500. // color: #3f3f3f;
  501. // }
  502. .idCard-box {
  503. margin-top: 10%;
  504. width: 100%;
  505. height: 50%;
  506. display: flex;
  507. flex-direction: row;
  508. /* background-color: red; */
  509. flex-wrap: wrap;
  510. .reverse {
  511. height: 30%;
  512. width: 40%;
  513. display: flex;
  514. align-items: center;
  515. justify-content: center;
  516. // background-color: blue;
  517. margin: 0 5% 0 5%;
  518. image {
  519. width: 100%;
  520. height: 100%;
  521. }
  522. }
  523. }
  524. /* 表单分区样式 */
  525. .con_size {
  526. font-size: 1rem;
  527. font-weight: bold;
  528. margin: 1rem 0;
  529. color: #000000;
  530. display: flex;
  531. flex-direction: row;
  532. align-items: center;
  533. }
  534. .con_size_img{
  535. height: 100%;
  536. width: 2%;
  537. margin-right: 2%;
  538. }
  539. .form-button{
  540. width: 100%;
  541. height:100%;
  542. // background-color: #000000;
  543. display: flex;
  544. align-items: center;
  545. justify-content: center;
  546. }
  547. .button{
  548. height: 100%;
  549. width: 100%;
  550. background-color: #044f7a;
  551. color: #ffffff;
  552. border-radius: 1rem;
  553. }
  554. </style>