payWay1.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <view class="pageBody">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <!-- 获取保单方式 -->
  6. <view class="getProposalWay">
  7. <view class="title d-flex a-center j-sb">
  8. <text style="font-weight: bold;">保单获取方式</text>
  9. </view>
  10. <view class="content">
  11. <view class="row d-flex a-center ">
  12. <view class="left">保单形式:</view>
  13. <picker class="right d-flex flex-1" mode="selector" range-key="label" :range="insurancePolicyList" @change="bindPickerChange($event,'insurancePolicy')">
  14. <view class="d-flex a-center j-sb flex-1" style="width: 100%;">
  15. <view>{{insurancePolicy}}</view>
  16. <view class="icon iconfont icon-xiala" style="margin-left: 20upx;font-size: 28upx;"></view>
  17. </view>
  18. </picker>
  19. </view>
  20. <template v-if="insurancePolicy=='电子'">
  21. <!-- 邮箱地址 -->
  22. <view class="row d-flex a-center ">
  23. <view class="left">邮箱地址:</view>
  24. <input class="right d-flex flex-1" type="text" style="font-size: 28upx;" placeholder="请输入邮箱地址" v-model="email" />
  25. </view>
  26. </template>
  27. <template v-if="insurancePolicy=='纸质'">
  28. <view class="row d-flex a-center ">
  29. <view class="left">配送方式:</view>
  30. <picker disabled class="right d-flex flex-1" mode="selector" range-key="label" :range="distributionList" @change="bindPickerChange($event,'distribution')">
  31. <view class="d-flex a-center j-sb flex-1" style="width: 100%;">
  32. <view>{{distribution}}</view>
  33. <view class="icon iconfont icon-xiala" style="margin-left: 20upx;font-size: 28upx;"></view>
  34. </view>
  35. </picker>
  36. </view>
  37. </template>
  38. <template v-if="(insurancePolicy=='纸质')&&(distribution=='邮寄')">
  39. <view class="row d-flex a-center ">
  40. <view class="left">收件人:</view>
  41. <input class="right d-flex flex-1" type="text" placeholder="请输入收件人" v-model="mailAddrName" />
  42. </view>
  43. <view class="row d-flex a-center ">
  44. <view class="left">手机号:</view>
  45. <input class="right d-flex flex-1" type="text" placeholder="请输入手机号" v-model="mailAddrMobile" />
  46. </view>
  47. <view class="row d-flex a-center " style="height:auto;min-height: 80upx;padding: 10upx 0;box-sizing: border-box; ">
  48. <view class="left d-flex">地址:</view>
  49. <view class="right flex-column d-flex flex-1">
  50. <view class="d-flex a-center j-sb" @tap="showMulLinkageThreePicker">
  51. <template v-if="!!countryFore">
  52. <view>{{countryFore}}</view>
  53. </template>
  54. <template v-if="!countryFore">
  55. <view style="color: #999;font-size: 28upx;">请选择收件地址</view>
  56. </template>
  57. <view class="icon iconfont icon-xiala" style="margin-left: 20upx;font-size: 28upx;"></view>
  58. </view>
  59. <view style="margin-top: 20upx;">
  60. <input width="200upx" style="font-size: 26upx;" v-model="mailAddress" placeholder-style="font-size:26upx; color:#999;" placeholder="请填写具体路名、门牌地址"/>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. </view>
  66. </view>
  67. <view class="bodyContent">
  68. <view>如您在投保过程中,有任何疑问,可以联系我们电话客服,将会有公司专属坐席为您服务解答。</view>
  69. <button @tap="onlinePay" class="user-set-btn d-flex a-center j-center main-bg-color" type="primary" style="margin-top: 40upx;">线上缴费</button>
  70. <button @tap="payPopupShow" class="user-set-btn d-flex a-center j-center" type="default" style="margin-top: 40upx;">线下缴费</button>
  71. </view>
  72. <wyb-popup ref="popupPay" type="center" mode="size-fixed" height="520" width="600" radius="6" :showCloseIcon="true">
  73. <view class="popupBody">
  74. <view class="popHeader d-flex a-center j-center">
  75. 掌柜客服温馨提示
  76. </view>
  77. <view class="popupContent">
  78. <view class="desc">非常感谢您选择线下支付,我们客服工作人员会尽快联系您进行投保,感谢您的支持。</view>
  79. <button @tap="mobileCall" class="user-set-btn d-flex a-center j-center" type="primary" style="margin-top: 40upx;">电话咨询客服</button>
  80. <button @tap="onlineCustomerService" class="user-set-btn d-flex a-center j-center" type="default" style="margin-top: 40upx;">等待工作人员联系</button>
  81. </view>
  82. </view>
  83. </wyb-popup>
  84. <!-- 省市选择 -->
  85. <w-picker mode="region" :defaultVal="['山西省','太原市','小店区']" :areaCode="['14','1401','140105']" @confirm="onConfirmCity" ref="cityPicker" themeColor="#007AFF"></w-picker>
  86. </view>
  87. </template>
  88. <script>
  89. import {mapMutations} from "vuex"
  90. import wPicker from "@/components/modules/carInsure/w-picker/w-picker"
  91. import wybPopup from '@/components/common/wyb-popup/wyb-popup.vue'
  92. export default {
  93. components: {
  94. wybPopup,
  95. wPicker
  96. },
  97. data() {
  98. return {
  99. orderno:'',
  100. email:"",
  101. insurancePolicy:"电子",// 保单形式
  102. insurancePolicyList:["电子","纸质"],
  103. distribution:'邮寄',//邮寄方式
  104. distributionList:["邮寄","网点自取"],
  105. mailAddrName:"",//邮寄地址名字
  106. mailAddrMobile:"",//邮寄地址电话
  107. countryFore:"",//邮寄城市地址
  108. mailAddress:"",//邮寄地址
  109. }
  110. },
  111. onLoad(params) {
  112. this.orderno = params.orderno;
  113. },
  114. methods: {
  115. ...mapMutations(['setOrderStage','setOrderType']),
  116. //选择下拉
  117. bindPickerChange(e,type){
  118. this[type]= this[type+'List'][e.target.value];
  119. },
  120. // 城市三级联动
  121. showMulLinkageThreePicker() {
  122. this.$refs.cityPicker.show()
  123. },
  124. onConfirmCity(e) {
  125. this.countryFore = e.result;
  126. this.mailAddress="";
  127. },
  128. payPopupShow(){
  129. if(this.checkForm()){
  130. this.$refs.popupPay.show() // 显示
  131. }
  132. },
  133. // 电话咨询
  134. mobileCall(){
  135. uni.makePhoneCall({
  136. phoneNumber: '4006333016',
  137. success: () => {
  138. this.$refs.popupPay.hide()
  139. console.log("成功拨打电话")
  140. }
  141. })
  142. },
  143. //线上客服
  144. async onlineCustomerService(){
  145. this.$refs.popupPay.hide()
  146. if(this.checkForm()){
  147. var data = {
  148. "billtype": "",
  149. "mailaddress": "",
  150. "mailtype": "",
  151. "orderno": this.orderno,
  152. "paytype": "线下缴费",
  153. "policytype": "",
  154. "receiptname": "",
  155. "receiptphone": ""
  156. }
  157. if(this.insurancePolicy == '电子'){
  158. data.policytype = this.insurancePolicy;
  159. data.mailtype = '邮箱';
  160. data.mailaddress = this.email;
  161. }
  162. if(this.insurancePolicy == '纸质'){
  163. data.policytype = this.insurancePolicy;
  164. data.mailtype = this.distribution;
  165. data.mailaddress = this.countryFore + this.mailAddress;
  166. data.receiptname = this.mailAddrName;
  167. data.receiptphone = this.mailAddrMobile;
  168. }
  169. let res = await this.$http.post('/insOrder/savePayType',data);
  170. if(res.code ==200){
  171. uni.showToast({ title: '15分钟内工作人员将会与您联系进行线下支付,请耐心等待', icon:"success",duration:2000 });
  172. setTimeout(() => {
  173. this.setOrderType(0);
  174. this.setOrderStage(3);
  175. this.navigate({url:"/pages/orders/orders"},"switchTab",true);
  176. }, 2000);
  177. }
  178. }
  179. },
  180. // 验证是否是邮箱
  181. checkEmail(str) {
  182. return /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(str);
  183. },
  184. // 手机号验证
  185. isMobile(str){
  186. return /^1[3456789]\d{9}$/.test(str.trim())
  187. },
  188. checkForm(){
  189. if(this.insurancePolicy == '电子'){
  190. if(!this.checkEmail(this.email)){
  191. uni.showToast({ title: '请输入正确的邮箱地址', icon:'none' });
  192. return false;
  193. }else{
  194. return true;
  195. }
  196. }
  197. if((this.insurancePolicy == '纸质') && (this.distribution == '邮寄')){
  198. if(this.mailAddrName.trim()==""){
  199. uni.showToast({ title: '请输入收件人姓名', icon:'none' });
  200. return false;
  201. }else if(!this.isMobile(this.mailAddrMobile)){
  202. uni.showToast({ title: '请输入正确的手机号', icon:'none' });
  203. return false;
  204. }else if(this.countryFore.trim()==""){
  205. uni.showToast({ title: '请选择邮寄城市', icon:'none' });
  206. return false;
  207. }else if(this.mailAddress.trim()==""){
  208. uni.showToast({ title: '请输入详细地址', icon:'none' });
  209. return false;
  210. }else{
  211. return true;
  212. }
  213. }
  214. },
  215. //线上缴费
  216. onlinePay(){
  217. if(this.checkForm()){
  218. uni.showModal({
  219. title: "提示",
  220. content: "选择消费方式后不可更改,是否确认选择线上缴费?",
  221. success: async (res) => {
  222. if (res.confirm) {
  223. var data = {
  224. "billtype": "",
  225. "mailaddress": "",
  226. "mailtype": "",
  227. "orderno": this.orderno,
  228. "paytype": "线上缴费",
  229. "policytype": "",
  230. "receiptname": "",
  231. "receiptphone": ""
  232. }
  233. if(this.insurancePolicy == '电子'){
  234. data.policytype = this.insurancePolicy;
  235. data.mailtype = '邮箱';
  236. data.mailaddress = this.email;
  237. }
  238. if(this.insurancePolicy == '纸质'){
  239. data.policytype = this.insurancePolicy;
  240. data.mailtype = this.distribution;
  241. data.mailaddress = this.countryFore + this.mailAddress;
  242. data.receiptname = this.mailAddrName;
  243. data.receiptphone = this.mailAddrMobile;
  244. }
  245. let res= await this.$http.post('/insOrder/savePayType',data);
  246. if(res.code ==200){
  247. this.navigate({url:"/pages/carInsure/payCode?orderno="+this.orderno},"reLaunch",true);
  248. }
  249. }
  250. }
  251. })
  252. }
  253. }
  254. }
  255. }
  256. </script>
  257. <style>
  258. .pageBody{
  259. max-width: 750upx;
  260. min-height: 100vh;
  261. background: #f5f5f5;
  262. font-size: 26upx;
  263. font-family: "Arial,Helvetica,sans-serif,PingFangSC";
  264. }
  265. .bodyContent{
  266. background: #FFFFFF;
  267. padding: 30upx;
  268. }
  269. .popupBody{
  270. padding: 0upx 30upx;
  271. }
  272. .popHeader{
  273. height: 100upx;
  274. font-size: 34upx;
  275. font-weight: bold;
  276. border-bottom: 1px solid #FAFAFA;
  277. }
  278. .popupContent{
  279. padding: 20upx 0;
  280. }
  281. .getProposalWay{
  282. margin-bottom: 20upx;
  283. background: #FFFFFF;
  284. padding: 0upx 30upx;
  285. }
  286. .getProposalWay .title{
  287. height: 80upx;
  288. font-size: 32upx;
  289. box-shadow:inset 0 -3upx 0px #fafafa;
  290. }
  291. .getProposalWay .content .row{
  292. height: 80upx;
  293. border-bottom: 1px solid #F9F9F9;
  294. }
  295. .getProposalWay .content .row .left{
  296. width: 170upx;
  297. flex-shrink: 0;
  298. font-size: 28upx;
  299. }
  300. .getProposalWay .content .row .right{
  301. font-size: 28upx;
  302. }
  303. </style>