payment.vue 30 KB

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