payment.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165
  1. <template>
  2. <view>
  3. <!-- 弹窗 v-model双向绑定值 mode弹出位置 border-radius弹出层圆角-->
  4. <u-popup v-model="showservice" mode="bottom" border-radius="14" :closeable="true" :mask-close-able="false"
  5. :safe-area-inset-bottom="true">
  6. <view class="header-Discount">
  7. 选择服务包
  8. </view>
  9. <scroll-view scroll-y="true" style="height: 650rpx;">
  10. <view v-for="(item,index) in serviceList" :key="index">
  11. <view class="card flex justify-center">
  12. <view class="taocan" :data-id="item.order_pack.id" @click="details(item.order_pack)">
  13. <view class="tc_left">
  14. <text>{{item.order_pack.pack_name}}</text>
  15. </view>
  16. <view class="tc_right">
  17. <view style="width: 100%;">
  18. <view class="">{{item.order_pack.pack_intro}}</view>
  19. <!-- <view class="text">{{item.desc}}</view> -->
  20. <view class="text">
  21. <view class="">
  22. 图文次数:{{item.order_pack.chat_num}}次
  23. </view>
  24. <view class="">
  25. 电话分钟:{{item.order_pack.phone_minutes}}分
  26. </view>
  27. <view class="">
  28. 门诊次数:{{item.order_pack.appoint_num}}次
  29. </view>
  30. <!-- <text style="text-align: left;">时长:{{item.order_pack.effective_days}}天</text> -->
  31. <!-- <text style="float: right;color: #FF4F61;font-weight: bold;">¥{{item.order_pack.pack_price/100}}</text> -->
  32. </view>
  33. </view>
  34. <view class="margin-top-xs">
  35. 剩余时长:
  36. <u-count-down color="#EEAA3F" separator="zh" :timestamp="item.order_pack.end_time-miao"></u-count-down>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="cu-tabbar-height"></view>
  43. </scroll-view>
  44. </u-popup>
  45. <u-popup v-model="discountshow" mode="bottom" border-radius="14" safe-area-inset-bottom="true">
  46. <view class="header-Discount">
  47. 优惠卷
  48. </view>
  49. <view class="body-Discount">
  50. <view class="collar">
  51. <!-- <view class="title-Discount">
  52. 领券
  53. </view> -->
  54. <scroll-view scroll-y="true" style="height: 550rpx;">
  55. <view class="couponList">
  56. <view class="couponItem" v-for="(item,index) in list" :key="index">
  57. <view class="couponItem-subject">
  58. <view class="couponItem-subject-left">
  59. <view class="couponItem-subject-price">
  60. <text class="couponItem-subject-icon">{{item.type==1?'¥':''}}</text>
  61. <text class="couponItem-subject-price-min">{{item.type==1?item.money/100:item.discount.substring(0,item.discount.indexOf(".")+2)}}</text>
  62. <view class="couponItem-subject-price-reduce">{{item.name}}</view>
  63. </view>
  64. </view>
  65. <view class="couponItem-subject-right">
  66. <view class="couponItem-subject-right-header">
  67. <span class="couponItem-subject-right-header-icon">{{item.type==1?'满减':'折扣'}}</span>
  68. {{item.title}}
  69. </view>
  70. <button :data-index="index" @click="collectCoupons(item,index)" class="couponItem-subject-right-btn">使用</button>
  71. <view class="closing-date">
  72. {{item.start_time}} - {{item.end_time}}
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </scroll-view>
  79. </view>
  80. </view>
  81. </u-popup>
  82. <u-popup v-model="popupShow" mode="center" border-radius="14" width="80%" height="40%" close-icon-pos="top-left"
  83. :closeable="true" close-icon-color="#333333" negative-top="250">
  84. <view style="height: 100%;width: 100%;">
  85. <!-- 标题占20% -->
  86. <view style="height: 20%;width: auto;">
  87. <text style="font-size: 30rpx;font-weight: bold;display: flex;justify-content: center;align-items: flex-end;height: 100%;">超级妈力</text>
  88. </view>
  89. <!-- 金额占30% -->
  90. <view style="height: 30%;width: auto;border-bottom: 1rpx solid #EFEFEF;margin-left: 20rpx;margin-right: 20rpx;">
  91. <text style="font-size: 78rpx;font-weight: 700;display: flex;justify-content: center;align-items: center;height: 100%;">¥{{value=='钱包余额支付'?norderAmount:'0'}}</text>
  92. </view>
  93. <!-- 支付方式占20% -->
  94. <view style="height: 20%;width: auto;padding-left: 40rpx;">
  95. <view style="font-size: 30rpx;display: flex;align-items: center;height: 100%;">
  96. <text v-if="value=='钱包余额支付'">余额支付 (余额¥{{info.balance/100}}元)</text>
  97. <text v-else>服务包抵扣</text>
  98. <!-- <text v-else>微信支付</text> -->
  99. </view>
  100. </view>
  101. <!-- 按钮占25% -->
  102. <!-- <view style="height: 25%;width: auto;">
  103. <view style="display: flex;justify-content: center;align-items: center;height: 100%;">
  104. <u-button type="primary" style="width: 100%;" @click="payment">确认支付</u-button>
  105. </view>
  106. </view> -->
  107. <u-message-input :maxlength="maxnum" :disabled-keyboard="true" :value="password" mode="bottomLine" :breathe="true"
  108. :focus="true" :dot-fill="true"></u-message-input>
  109. </view>
  110. </u-popup>
  111. <uni-list :border="false">
  112. <image src="https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/caixian.png" style="width: 100%; height: 5rpx; background-color: #FFFFFF;"></image>
  113. <uni-list-item :border="false">
  114. <view slot="header" style="color:#666666 ; font-size: 28rpx;">
  115. <text v-if="infodata.product_type == '1' ">{{infodata.doctorname}} 电话咨询</text>
  116. <text v-if="infodata.product_type == '2' ">{{infodata.doctorname}} 图文咨询</text>
  117. <text v-if="infodata.product_type == '3' ">{{infodata.doctorname}} 门诊预约</text>
  118. <text v-if="infodata.product_type == '4' ">疫苗接种预约</text>
  119. <text v-if="infodata.product_type == '5' ">儿保预约</text>
  120. <text v-if="infodata.product_type == '6' ">服务包</text>
  121. </view>
  122. <view slot="footer" style="color:#FF4F61 ;font-weight: 500;">
  123. {{infodata.total_amount+'元'}}
  124. </view>
  125. </uni-list-item>
  126. <!-- 线条 -->
  127. <u-line color="#EFEFEF" />
  128. <uni-list-item :border="false" :link="true" @click="list.length==0?false: discountshow = true" v-if="paytype!=3">
  129. <view slot="header" style="color:#666666 ; font-size: 28rpx;">
  130. 优惠券
  131. </view>
  132. <view slot="footer" style="font-size: 30rpx;">
  133. {{list.length==0?'暂无优惠卷':coupon}}
  134. </view>
  135. </uni-list-item>
  136. </uni-list>
  137. <u-gap height="20" bg-color="#F6F6F6"></u-gap>
  138. <uni-list :border="false">
  139. <uni-list-item :border="false">
  140. <view slot="header" style="font-size: 28rpx; font-weight: 500;color: #666666;">支付方式</view>
  141. </uni-list-item>
  142. <!-- 加一个单选 -->
  143. <u-radio-group v-model="value" v-for="(item, index) in paymenMethod" :key="index">
  144. <uni-list-item :border="false" @click="setmode(item)" :clickable="true">
  145. <view slot="header">
  146. <text style="font-size: 28rpx;font-weight: 400;color: #333333;">{{item.name}}</text>
  147. </view>
  148. <view slot="footer">
  149. <u-radio @change="radioChange" :key="index" :name="item.name" :disabled="item.disabled">
  150. </u-radio>
  151. </view>
  152. </uni-list-item>
  153. <u-line color="#EFEFEF" />
  154. </u-radio-group>
  155. </uni-list>
  156. <!-- 按钮 -->
  157. <view class="cu-bar bg-white tabbar border shop" style="position: fixed; bottom: 0; z-index: 99;width: 100%;">
  158. <view class="" style="width:75%;">
  159. <text style="padding-left: 30rpx;font-size: 32rpx;">合计:</text>
  160. <text style="padding-left: 20rpx;font-size: 36;font-weight: 500;color: #FF4F61;">{{orderAmount+'元'}}</text>
  161. </view>
  162. <view class="submit text-white" @click="confirmpay" style="background-color: rgb(11,115,186); font-size: 32rpx;">确认支付</view>
  163. </view>
  164. <u-keyboard @change="valChange" @backspace="backspace" ref="uKeyboard" mode="number" v-model="popupShow" :tooltip="false"
  165. :mask="false"></u-keyboard>
  166. <u-no-network></u-no-network>
  167. </view>
  168. </template>
  169. <script>
  170. import store from '@/store'
  171. export default {
  172. onLoad(op) {
  173. this.infodata = JSON.parse(op.data)
  174. this.norderAmount = this.infodata.total_amount
  175. if (this.infodata.product_type != 6) {
  176. this.paymenMethod.push({
  177. name: '服务包抵扣',
  178. disabled: false
  179. })
  180. }
  181. console.log(this.infodata)
  182. },
  183. onShow() {
  184. this.orderAmount = this.norderAmount
  185. this.getUserInfo()
  186. this.pageindex = 1
  187. this.pageservice = 1
  188. this.serviceList = []
  189. this.list = []
  190. this.getcoupon()
  191. this.getserviceList()
  192. this.miao = parseInt(new Date().getTime() / 1000)
  193. },
  194. data() {
  195. return {
  196. //秒数
  197. miao: "",
  198. //服务包弹窗
  199. showservice: false,
  200. //医生名称
  201. doctorName: '',
  202. ndoctorName: '渣渣宝',
  203. //订单金额
  204. orderAmount: '',
  205. norderAmount: 19.9,
  206. //优惠券
  207. coupon: '不使用优惠券',
  208. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  209. value: '钱包余额支付',
  210. paymenMethod: [{
  211. name: '钱包余额支付',
  212. disabled: false
  213. }],
  214. //弹出层控制
  215. popupShow: false,
  216. //订单类型
  217. //支付数据类型
  218. infodata: {},
  219. info: {},
  220. show: false,
  221. maxnum: 6,
  222. password: "",
  223. discountshow: false,
  224. list: [],
  225. couponid: "",
  226. pageindex: 1,
  227. pageservice: 1,
  228. serviceList: [],
  229. paytype: 2,
  230. serviceid: ""
  231. }
  232. },
  233. methods: {
  234. details(item) {
  235. this.serviceid = item.id
  236. this.showservice = false
  237. console.log(item)
  238. },
  239. getserviceList: async function() {
  240. let res = await this.$request.post("/api/v1/order/orderList", {
  241. page: this.pageservice,
  242. // docter_id:this.infodata.docter_id
  243. list_type: 1,
  244. product_type: 6,
  245. is_pack_expire: 2
  246. })
  247. console.log(res)
  248. if (res.status == 0) {
  249. if (this.pageservice > res.data.last_page) {
  250. uni.showToast({
  251. title: "没有更多了",
  252. icon: "none"
  253. })
  254. } else {
  255. this.serviceList = this.serviceList.concat(res.data.data)
  256. this.pageservice++
  257. }
  258. }
  259. },
  260. getcoupon: async function() {
  261. let res = await this.$request.post("/api/v1/coupon/userCouponList", {
  262. page: this.pageindex
  263. })
  264. console.log(res)
  265. if (res.status == 0) {
  266. if (this.pageindex > res.data.last_page) {
  267. uni.showToast({
  268. title: "没有更多了",
  269. icon: "none"
  270. })
  271. } else {
  272. this.list = this.list.concat(res.data.data)
  273. this.list.forEach(item => {
  274. item.start_time = this.$util.formatDate(item.start_time)
  275. item.end_time = this.$util.formatDate(item.end_time)
  276. })
  277. this.pageindex++
  278. }
  279. }
  280. },
  281. // 选中某个单选框时,由radio时触发
  282. discount() {
  283. },
  284. radioChange(e) {
  285. console.log(e);
  286. },
  287. // 选中任一radio时,由radio-group触发
  288. radioGroupChange(e) {
  289. // console.log(e);
  290. },
  291. //充值
  292. recharge(e) {
  293. },
  294. click(e) {
  295. console.log(e)
  296. },
  297. setmode(item) {
  298. this.value = item.name
  299. if (this.value == '服务包抵扣') {
  300. if (this.serviceList.length == 0) {
  301. uni.showToast({
  302. title: "暂无服务包可用",
  303. icon: "none"
  304. })
  305. this.value = "钱包余额支付"
  306. this.paytype = 2
  307. return false
  308. } else {
  309. this.paytype = 3
  310. this.showservice = true
  311. }
  312. } else if (this.value == '钱包余额支付') {
  313. this.paytype = 2
  314. }
  315. },
  316. collectCoupons(item, index) {
  317. this.norderAmount = this.infodata.total_amount
  318. this.orderAmount = this.infodata.total_amount
  319. if (item.type == 1) {
  320. if (this.infodata.total_amount * 100 < item.min_consume_amount) {
  321. uni.showToast({
  322. title: "满减金额不够",
  323. icon: "none"
  324. })
  325. this.discountshow = false
  326. return false
  327. } else {
  328. this.coupon = item.name
  329. this.couponid = item.id
  330. let price = (this.norderAmount * 100) - item.money
  331. this.norderAmount = price / 100
  332. this.orderAmount = price / 100
  333. this.discountshow = false
  334. this.$forceUpdate()
  335. }
  336. } else if (item.type == 2) {
  337. this.coupon = item.name
  338. this.couponid = item.id
  339. let price = (this.norderAmount * 100) * ((item.discount.substring(0, item.discount.indexOf(".") + 2) - 0) / 10)
  340. this.norderAmount = price / 100
  341. this.orderAmount = price / 100
  342. this.discountshow = false
  343. this.$forceUpdate()
  344. }
  345. },
  346. confirmpay() {
  347. if (this.info.balance < this.infodata.total_amount * 100) {
  348. uni.showModal({
  349. title: "错误提示",
  350. content: "余额不足,请先充值",
  351. confirmText: "去充值",
  352. success(res) {
  353. if (res.confirm) {
  354. uni.navigateTo({
  355. url: "../personal/recharge"
  356. })
  357. }
  358. }
  359. })
  360. } else {
  361. this.popupShow = true
  362. this.show = true
  363. }
  364. },
  365. getUserInfo: async function() {
  366. let res = await this.$request.post('/api/v1/user/userInfo')
  367. if (res.status == 0) {
  368. this.info = res.data
  369. console.log(this.info)
  370. }
  371. },
  372. payyuyue: async function() {
  373. let res = await this.$request.post("/api/v1/order/appointPlaceOrder", {
  374. product_type: this.infodata.product_type,
  375. docter_id: this.infodata.docter_id,
  376. patient_id: this.infodata.patient_id,
  377. total_amount: this.infodata.total_amount * 100,
  378. organization_id: this.infodata.organization_id,
  379. schedule_date: this.infodata.schedule_date,
  380. time_period_id: this.infodata.time_period_id,
  381. payment_type: this.paytype,
  382. pay_password: this.password,
  383. user_coupon_id: this.couponid,
  384. order_pack_id: this.serviceid
  385. })
  386. if (res.status == 0) {
  387. this.popupShow = false
  388. this.show = false
  389. uni.showToast({
  390. title: "支付成功!",
  391. duration: 1500
  392. })
  393. setTimeout(() => {
  394. uni.redirectTo({
  395. url: "order?type=" + this.infodata.product_type
  396. })
  397. }, 1500)
  398. } else {
  399. if (res.message == '密码错误') {
  400. uni.showModal({
  401. title: "提示",
  402. content: res.message,
  403. confirmText: "重试",
  404. success: (res) => {
  405. if (res.confirm) {
  406. this.password = ""
  407. } else if (res.cancel) {
  408. this.popupShow = false
  409. this.show = false
  410. this.password = ""
  411. }
  412. },
  413. })
  414. } else if (res.message == '未设置支付密码') {
  415. uni.showModal({
  416. title: "提示",
  417. content: res.message,
  418. confirmText: "设置",
  419. success: (res) => {
  420. if (res.confirm) {
  421. this.password = ""
  422. uni.navigateTo({
  423. url: "../index/paypassword"
  424. })
  425. } else if (res.cancel) {
  426. this.popupShow = false
  427. this.show = false
  428. this.password = ""
  429. }
  430. },
  431. })
  432. } else {
  433. uni.showModal({
  434. title: "提示",
  435. content: res.message,
  436. confirmText: "确定",
  437. showCancel: false,
  438. success: (rr) => {
  439. if (rr.confirm) {
  440. this.popupShow = false
  441. this.show = false
  442. this.password = ""
  443. }
  444. }
  445. })
  446. }
  447. }
  448. },
  449. paypacks: async function() {
  450. let num = ""
  451. if (this.infodata.is_need_insurance) {
  452. num = 1
  453. } else {
  454. num = 0
  455. }
  456. let res = await this.$request.post("/api/v1/order/packPlaceOrder", {
  457. patient_id: this.infodata.patient_id,
  458. total_amount: this.infodata.total_amount * 100,
  459. service_pack_id: this.infodata.service_pack_id,
  460. is_security: this.infodata.is_security,
  461. guardian_name: this.infodata.guardian_name,
  462. relationship_type: this.infodata.relationship_type,
  463. payment_type: this.infodata.payment_type,
  464. pay_password: this.password,
  465. user_coupon_id: this.couponid,
  466. is_need_insurance: num
  467. })
  468. console.log(res)
  469. if (res.status == 0) {
  470. this.popupShow = false
  471. this.show = false
  472. uni.showToast({
  473. title: "支付成功!",
  474. duration: 1500
  475. })
  476. setTimeout(() => {
  477. uni.redirectTo({
  478. url: "order?type=" + this.infodata.product_type
  479. })
  480. }, 1500)
  481. } else {
  482. if (res.message == '密码错误') {
  483. uni.showModal({
  484. title: "提示",
  485. content: res.message,
  486. confirmText: "重试",
  487. success: (res) => {
  488. if (res.confirm) {
  489. this.password = ""
  490. } else if (res.cancel) {
  491. this.popupShow = false
  492. this.show = false
  493. this.password = ""
  494. }
  495. },
  496. })
  497. } else if (res.message == '未设置支付密码') {
  498. uni.showModal({
  499. title: "提示",
  500. content: res.message,
  501. confirmText: "设置",
  502. success: (res) => {
  503. if (res.confirm) {
  504. this.password = ""
  505. uni.navigateTo({
  506. url: "../index/paypassword"
  507. })
  508. } else if (res.cancel) {
  509. this.popupShow = false
  510. this.show = false
  511. this.password = ""
  512. }
  513. },
  514. })
  515. } else {
  516. uni.showModal({
  517. title: "提示",
  518. content: res.message,
  519. confirmText: "确定",
  520. showCancel: false,
  521. success: (rr) => {
  522. if (rr.confirm) {
  523. this.popupShow = false
  524. this.show = false
  525. this.password = ""
  526. }
  527. }
  528. })
  529. }
  530. }
  531. },
  532. payphone: async function() {
  533. let res = await this.$request.post("/api/v1/order/consultPlaceOrder", {
  534. product_type: this.infodata.product_type,
  535. docter_id: this.infodata.docter_id,
  536. patient_id: this.infodata.patient_id,
  537. total_amount: this.infodata.total_amount * 100,
  538. phone: this.infodata.phone,
  539. phone_minutes: this.infodata.phone_minutes,
  540. payment_type: this.paytype,
  541. pay_password: this.password,
  542. user_coupon_id: this.couponid,
  543. order_pack_id: this.serviceid
  544. })
  545. if (res.status == 0) {
  546. this.popupShow = false
  547. this.show = false
  548. uni.showToast({
  549. title: "支付成功!",
  550. duration: 1500
  551. })
  552. setTimeout(() => {
  553. uni.redirectTo({
  554. url: "order?type=" + this.infodata.product_type
  555. })
  556. }, 1500)
  557. } else {
  558. if (res.message == '密码错误') {
  559. uni.showModal({
  560. title: "提示",
  561. content: res.message,
  562. confirmText: "重试",
  563. success: (res) => {
  564. if (res.confirm) {
  565. this.password = ""
  566. } else if (res.cancel) {
  567. this.popupShow = false
  568. this.show = false
  569. this.password = ""
  570. }
  571. },
  572. })
  573. } else if (res.message == '未设置支付密码') {
  574. uni.showModal({
  575. title: "提示",
  576. content: res.message,
  577. confirmText: "设置",
  578. success: (res) => {
  579. if (res.confirm) {
  580. this.password = ""
  581. uni.navigateTo({
  582. url: "../index/paypassword"
  583. })
  584. } else if (res.cancel) {
  585. this.popupShow = false
  586. this.show = false
  587. this.password = ""
  588. }
  589. },
  590. })
  591. } else {
  592. uni.showModal({
  593. title: "提示",
  594. content: res.message,
  595. confirmText: "确定",
  596. showCancel: false,
  597. success: (rr) => {
  598. if (rr.confirm) {
  599. this.popupShow = false
  600. this.show = false
  601. this.password = ""
  602. }
  603. }
  604. })
  605. }
  606. }
  607. },
  608. paychat: async function() {
  609. let res = await this.$request.post("/api/v1/order/consultPlaceOrder", {
  610. product_type: this.infodata.product_type,
  611. docter_id: this.infodata.docter_id,
  612. patient_id: this.infodata.patient_id,
  613. total_amount: this.infodata.total_amount * 100,
  614. symptoms: this.infodata.symptoms,
  615. medical_imgs: JSON.stringify(this.infodata.medical_imgs),
  616. payment_type: this.paytype,
  617. pay_password: this.password,
  618. user_coupon_id: this.couponid,
  619. order_pack_id: this.serviceid
  620. })
  621. if (res.status == 0) {
  622. this.popupShow = false
  623. this.show = false
  624. uni.showToast({
  625. title: "支付成功!",
  626. duration: 1500
  627. })
  628. setTimeout(() => {
  629. uni.redirectTo({
  630. url: "order?type=" + this.infodata.product_type
  631. })
  632. }, 1500)
  633. } else {
  634. if (res.message == '密码错误') {
  635. uni.showModal({
  636. title: "提示",
  637. content: res.message,
  638. confirmText: "重试",
  639. success: (res) => {
  640. if (res.confirm) {
  641. this.password = ""
  642. } else if (res.cancel) {
  643. this.popupShow = false
  644. this.show = false
  645. this.password = ""
  646. }
  647. },
  648. })
  649. } else if (res.message == '未设置支付密码') {
  650. uni.showModal({
  651. title: "提示",
  652. content: res.message,
  653. confirmText: "设置",
  654. success: (res) => {
  655. if (res.confirm) {
  656. this.password = ""
  657. uni.navigateTo({
  658. url: "../index/paypassword"
  659. })
  660. } else if (res.cancel) {
  661. this.popupShow = false
  662. this.show = false
  663. this.password = ""
  664. }
  665. },
  666. })
  667. } else {
  668. uni.showModal({
  669. title: "提示",
  670. content: res.message,
  671. confirmText: "确定",
  672. showCancel: false,
  673. success: (rr) => {
  674. if (rr.confirm) {
  675. this.popupShow = false
  676. this.show = false
  677. this.password = ""
  678. }
  679. }
  680. })
  681. }
  682. }
  683. },
  684. payvaccines: async function() {
  685. let res = await this.$request.post("/api/v1/order/appointPlaceOrder", {
  686. product_type: this.infodata.product_type,
  687. patient_id: this.infodata.patient_id,
  688. total_amount: this.infodata.total_amount * 100,
  689. organization_id: this.infodata.organization_id,
  690. schedule_date: this.infodata.schedule_date,
  691. time_period_id: this.infodata.time_period_id,
  692. vaccine_id: this.infodata.vaccine_id,
  693. payment_type: this.paytype,
  694. pay_password: this.password,
  695. user_coupon_id: this.couponid,
  696. order_pack_id: this.serviceid
  697. })
  698. if (res.status == 0) {
  699. this.popupShow = false
  700. this.show = false
  701. uni.showToast({
  702. title: "支付成功!",
  703. duration: 1500
  704. })
  705. setTimeout(() => {
  706. uni.redirectTo({
  707. url: "order?type=" + this.infodata.product_type
  708. })
  709. }, 1500)
  710. } else {
  711. if (res.message == '密码错误') {
  712. uni.showModal({
  713. title: "提示",
  714. content: res.message,
  715. confirmText: "重试",
  716. success: (res) => {
  717. if (res.confirm) {
  718. this.password = ""
  719. } else if (res.cancel) {
  720. this.popupShow = false
  721. this.show = false
  722. this.password = ""
  723. }
  724. },
  725. })
  726. } else if (res.message == '未设置支付密码') {
  727. uni.showModal({
  728. title: "提示",
  729. content: res.message,
  730. confirmText: "设置",
  731. success: (res) => {
  732. if (res.confirm) {
  733. this.password = ""
  734. uni.navigateTo({
  735. url: "../index/paypassword"
  736. })
  737. } else if (res.cancel) {
  738. this.popupShow = false
  739. this.show = false
  740. this.password = ""
  741. }
  742. },
  743. })
  744. } else {
  745. uni.showModal({
  746. title: "提示",
  747. content: res.message,
  748. confirmText: "确定",
  749. showCancel: false,
  750. success: (rr) => {
  751. if (rr.confirm) {
  752. this.popupShow = false
  753. this.show = false
  754. this.password = ""
  755. }
  756. }
  757. })
  758. }
  759. }
  760. },
  761. paychildcare: async function() {
  762. console.log(this.infodata.nurse_ids)
  763. let res = await this.$request.post("/api/v1/order/appointPlaceOrder", {
  764. product_type: this.infodata.product_type,
  765. patient_id: this.infodata.patient_id,
  766. total_amount: this.infodata.total_amount * 100,
  767. organization_id: this.infodata.organization_id,
  768. schedule_date: this.infodata.schedule_date,
  769. time_period_id: this.infodata.time_period_id,
  770. nurse_ids: JSON.stringify(this.infodata.nurse_ids),
  771. payment_type: this.paytype,
  772. pay_password: this.password,
  773. user_coupon_id: this.couponid,
  774. order_pack_id: this.serviceid
  775. })
  776. console.log(res)
  777. if (res.status == 0) {
  778. this.popupShow = false
  779. this.show = false
  780. uni.showToast({
  781. title: "支付成功!",
  782. duration: 1500
  783. })
  784. setTimeout(() => {
  785. uni.redirectTo({
  786. url: "order?type=" + this.infodata.product_type
  787. })
  788. }, 1500)
  789. } else {
  790. if (res.message == '密码错误') {
  791. uni.showModal({
  792. title: "提示",
  793. content: res.message,
  794. confirmText: "重试",
  795. success: (res) => {
  796. if (res.confirm) {
  797. this.password = ""
  798. } else if (res.cancel) {
  799. this.popupShow = false
  800. this.show = false
  801. this.password = ""
  802. }
  803. },
  804. })
  805. } else if (res.message == '未设置支付密码') {
  806. uni.showModal({
  807. title: "提示",
  808. content: res.message,
  809. confirmText: "设置",
  810. success: (res) => {
  811. if (res.confirm) {
  812. this.password = ""
  813. uni.navigateTo({
  814. url: "../index/paypassword"
  815. })
  816. } else if (res.cancel) {
  817. this.popupShow = false
  818. this.show = false
  819. this.password = ""
  820. }
  821. },
  822. })
  823. } else {
  824. uni.showModal({
  825. title: "提示",
  826. content: res.message,
  827. confirmText: "确定",
  828. showCancel: false,
  829. success: (rr) => {
  830. if (rr.confirm) {
  831. this.popupShow = false
  832. this.show = false
  833. this.password = ""
  834. }
  835. }
  836. })
  837. }
  838. }
  839. },
  840. //点击确认支付
  841. payment(e) {
  842. if (this.infodata.product_type == 1) {
  843. this.payphone()
  844. } else if (this.infodata.product_type == 2) {
  845. this.paychat()
  846. } else if (this.infodata.product_type == 6) {
  847. this.paypacks()
  848. } else if (this.infodata.product_type == 3) {
  849. this.payyuyue()
  850. } else if (this.infodata.product_type == 4) {
  851. this.payvaccines()
  852. } else if (this.infodata.product_type == 5) {
  853. this.paychildcare()
  854. }
  855. },
  856. // 按键被点击(点击退格键不会触发此事件)
  857. valChange(val) {
  858. // 将每次按键的值拼接到value变量中,注意+=写法
  859. this.password += val;
  860. if (this.password.charAt(0) != '0') {
  861. if (this.password.length == 6) {
  862. this.payment()
  863. }
  864. } else {
  865. this.password = ''
  866. uni.showToast({
  867. title: "密码不能以0开头",
  868. icon: "none"
  869. })
  870. }
  871. },
  872. // 退格键被点击
  873. backspace() {
  874. // 删除value的最后一个字符
  875. if (this.password.length) this.password = this.password.substr(0, this.password.length - 1);
  876. console.log(this.password);
  877. }
  878. },
  879. onHide() {
  880. this.popupShow = false
  881. },
  882. }
  883. </script>
  884. <style lang="scss">
  885. .card {
  886. width: 100%;
  887. height: auto;
  888. margin-top: 20rpx;
  889. // background-image: url(../../static/服务包.png);
  890. .taocan {
  891. width: 710rpx;
  892. height: 230rpx;
  893. position: relative;
  894. display: flex;
  895. border-radius: 10rpx;
  896. background: radial-gradient(circle at right top, transparent 15rpx, #fff 0) top left / 152rpx 51% no-repeat,
  897. radial-gradient(circle at right bottom, transparent 15rpx, #fff 0) bottom left /152rpx 51% no-repeat,
  898. radial-gradient(circle at left top, transparent 15rpx, #fff 0) top right /560rpx 51% no-repeat,
  899. radial-gradient(circle at left bottom, transparent 15rpx, #fff 0) bottom right /560rpx 51% no-repeat;
  900. filter: drop-shadow(0rpx 2rpx 12rpx 0rpx rgba(0, 0, 0, 0.04));
  901. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  902. }
  903. }
  904. .tc_left {
  905. display: flex;
  906. justify-content: center;
  907. align-items: center;
  908. width: 152rpx;
  909. text {
  910. font-size: 30rpx;
  911. font-weight: bold;
  912. }
  913. }
  914. .tc_right {
  915. display: flex;
  916. flex-direction: column;
  917. justify-content: center;
  918. width: 550rpx;
  919. padding: 0 20rpx;
  920. font-size: 26rpx;
  921. .text {
  922. padding: 10rpx 0rpx;
  923. width: 100%;
  924. }
  925. }
  926. /* 支付文字 */
  927. .paymentText {
  928. height: 60rpx;
  929. width: auto;
  930. background-color: #FFFFFF;
  931. padding: 30rpx 0 0 30rpx;
  932. font-size: 24rpx;
  933. }
  934. /* 优惠券样式 */
  935. .discount {
  936. position: relative;
  937. display: inline-block;
  938. margin-right: 5px;
  939. margin-left: 15px;
  940. padding: 0 9px 0 12px;
  941. border-top: 1px solid rgb(11, 115, 186);
  942. border-bottom: 1px solid rgb(11, 115, 186);
  943. height: 16px;
  944. line-height: 16px;
  945. color: rgb(11, 115, 186);
  946. font-size: 10px;
  947. }
  948. .discount::before {
  949. content: "";
  950. left: 0;
  951. width: 7px;
  952. position: absolute;
  953. top: -1px;
  954. height: 18px;
  955. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAkCAMAAACpD3pbAAAAPFBMVEUAAAD////kOTzqaGr+9vb4zc32vL3sdXfnTE/mRUfxmpz87O3yn6HqZ2npXWDlQEP97e33xsf3xsbxl5nHV2NIAAAAAXRSTlMAQObYZgAAAJpJREFUOMvllEsSwiAQRMnjF8g/3v+uKhIrjhHK0l16B4+C7hlALS07qSyS2kVlKnHmCpqdNvwYwTdY6yKGX7AeKtb+jmN3jLuYMMEd5XYBUMZ6cO/BHHhr7ut6wizxHOhvM+kUT5S5I77ZsGWU1kbsExsmiSdMBVc3l9a0tJaDdR+CVcryWtRBFLXYkku1oae955Xnv5Y+j/UKs1MGwyraxf4AAAAASUVORK5CYII=);
  956. background-size: 15px 18px;
  957. background-repeat: no-repeat;
  958. }
  959. .discount::after {
  960. right: 0;
  961. width: 4px;
  962. background-position: -11px 0;
  963. content: "";
  964. position: absolute;
  965. top: -1px;
  966. height: 18px;
  967. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAkCAMAAACpD3pbAAAAPFBMVEUAAAD////kOTzqaGr+9vb4zc32vL3sdXfnTE/mRUfxmpz87O3yn6HqZ2npXWDlQEP97e33xsf3xsbxl5nHV2NIAAAAAXRSTlMAQObYZgAAAJpJREFUOMvllEsSwiAQRMnjF8g/3v+uKhIrjhHK0l16B4+C7hlALS07qSyS2kVlKnHmCpqdNvwYwTdY6yKGX7AeKtb+jmN3jLuYMMEd5XYBUMZ6cO/BHHhr7ut6wizxHOhvM+kUT5S5I77ZsGWU1kbsExsmiSdMBVc3l9a0tJaDdR+CVcryWtRBFLXYkku1oae955Xnv5Y+j/UKs1MGwyraxf4AAAAASUVORK5CYII=);
  968. background-size: 15px 18px;
  969. background-repeat: no-repeat;
  970. }
  971. /* 优惠头部 */
  972. .header-Discount {
  973. position: relative;
  974. height: 46px;
  975. line-height: 46px;
  976. padding-left: 10px;
  977. font-size: 15px;
  978. color: #333;
  979. text-align: center;
  980. font-weight: 700;
  981. }
  982. .body-Discount {
  983. padding: 0 18px;
  984. font-size: 13px;
  985. color: #333;
  986. margin-bottom: 50px;
  987. }
  988. .body-Discount>.collar {
  989. position: relative;
  990. padding-bottom: 9px;
  991. }
  992. .body-Discount>.collar>.title-Discount {
  993. height: 40px;
  994. line-height: 40px;
  995. color: #262626;
  996. font-weight: 700;
  997. }
  998. .body-Discount>.collar .couponList>.couponItem {
  999. color: rgb(11, 115, 186);
  1000. margin-bottom: 18px;
  1001. padding: 12px 10px;
  1002. border-top: 6px solid currentColor;
  1003. box-shadow: 0 0 6px 0 rgba(0, 0, 0, .1);
  1004. border-radius: 6px;
  1005. }
  1006. .body-Discount>.collar .couponList>.couponItem>.couponItem-subject {
  1007. display: flex;
  1008. min-height: 58px;
  1009. color: rgb(11, 115, 186);
  1010. }
  1011. .body-Discount>.collar .couponList>.couponItem>.couponItem-subject>.couponItem-subject-left {
  1012. width: 220rpx;
  1013. margin-right: 10px;
  1014. line-height: 1;
  1015. text-align: center;
  1016. display: flex;
  1017. flex-direction: column;
  1018. justify-content: center;
  1019. overflow: hidden;
  1020. }
  1021. .couponItem-subject-price {
  1022. overflow: hidden;
  1023. text-overflow: ellipsis;
  1024. white-space: nowrap;
  1025. line-height: 1;
  1026. text-align: center;
  1027. }
  1028. .couponItem-subject-icon {
  1029. font-size: 14px;
  1030. display: inline-block;
  1031. vertical-align: bottom;
  1032. margin: 0 4px 3px 0;
  1033. }
  1034. .couponItem-subject-price-min {
  1035. position: relative;
  1036. top: 1px;
  1037. font-size: 36px;
  1038. letter-spacing: 0;
  1039. }
  1040. .couponItem-subject-price-reduce {
  1041. font-size: 14px;
  1042. margin-top: 5px;
  1043. }
  1044. .couponItem-subject-right {
  1045. flex: 1;
  1046. position: relative;
  1047. }
  1048. .couponItem-subject-right-header {
  1049. height: 36px;
  1050. line-height: 18px;
  1051. overflow: hidden;
  1052. text-overflow: ellipsis;
  1053. display: -webkit-box;
  1054. -webkit-line-clamp: 1;
  1055. -webkit-box-orient: vertical;
  1056. font-size: 12px;
  1057. color: #666;
  1058. }
  1059. .couponItem-subject-right-header-icon {
  1060. background-color: rgb(11, 115, 186);
  1061. color: #fff;
  1062. font-size: 12px;
  1063. display: inline-block;
  1064. padding: 0 6px 0 12px;
  1065. height: 14px;
  1066. margin-right: 4px;
  1067. line-height: 14px;
  1068. position: relative;
  1069. border-radius: 0 3px 3px 0;
  1070. }
  1071. .couponItem-subject-right-header-icon::before {
  1072. position: absolute;
  1073. z-index: 1;
  1074. content: "";
  1075. width: 0;
  1076. top: 0;
  1077. left: -7px;
  1078. height: 0;
  1079. border-top: 7px solid #fff;
  1080. border-right: 7px solid transparent;
  1081. border-bottom: 7px solid #fff;
  1082. border-left: 7px solid #fff;
  1083. }
  1084. .couponItem-subject-right-header-icon::after {
  1085. content: ".";
  1086. position: absolute;
  1087. color: #fff;
  1088. left: 5px;
  1089. top: -6px;
  1090. font-size: 20px;
  1091. }
  1092. .couponItem-subject-right-btn {
  1093. background-color: rgb(11, 115, 186);
  1094. color: #fff;
  1095. font-size: 12px;
  1096. position: absolute;
  1097. right: 0;
  1098. bottom: 0;
  1099. width: 68px;
  1100. height: 20px;
  1101. line-height: 20px;
  1102. text-align: center;
  1103. border-radius: 10px;
  1104. box-sizing: border-box;
  1105. z-index: 2;
  1106. }
  1107. .desc-style {
  1108. padding: 5px 18px 10px 18px;
  1109. line-height: 1.3;
  1110. position: relative;
  1111. font-size: 12px;
  1112. max-height: 46px;
  1113. overflow: hidden;
  1114. color: #666;
  1115. background-color: white;
  1116. }
  1117. .closing-date {
  1118. padding-right: 68px;
  1119. position: absolute;
  1120. left: 0;
  1121. bottom: 0;
  1122. box-sizing: border-box;
  1123. width: 100%;
  1124. line-height: 20px;
  1125. font-size: 10px;
  1126. color: #8c8c8c;
  1127. }
  1128. </style>