payment.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  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. order_id: ""
  232. }
  233. },
  234. methods: {
  235. details(item) {
  236. this.serviceid = item.id
  237. this.showservice = false
  238. console.log(item)
  239. },
  240. getserviceList: async function() {
  241. let res = await this.$request.post("/api/v1/order/orderList", {
  242. page: this.pageservice,
  243. // docter_id:this.infodata.docter_id
  244. list_type: 1,
  245. product_type: 6,
  246. is_pack_expire: 2
  247. })
  248. console.log(res)
  249. if (res.status == 0) {
  250. if (this.pageservice > res.data.last_page) {
  251. uni.showToast({
  252. title: "没有更多了",
  253. icon: "none"
  254. })
  255. } else {
  256. this.serviceList = this.serviceList.concat(res.data.data)
  257. this.pageservice++
  258. }
  259. }
  260. },
  261. getcoupon: async function() {
  262. let res = await this.$request.post("/api/v1/coupon/userCouponList", {
  263. page: this.pageindex
  264. })
  265. console.log(res)
  266. if (res.status == 0) {
  267. if (this.pageindex > res.data.last_page) {
  268. uni.showToast({
  269. title: "没有更多了",
  270. icon: "none"
  271. })
  272. } else {
  273. this.list = this.list.concat(res.data.data)
  274. this.list.forEach(item => {
  275. item.start_time = this.$util.formatDate(item.start_time)
  276. item.end_time = this.$util.formatDate(item.end_time)
  277. })
  278. this.pageindex++
  279. }
  280. }
  281. },
  282. // 选中某个单选框时,由radio时触发
  283. discount() {
  284. },
  285. radioChange(e) {
  286. console.log(e);
  287. },
  288. // 选中任一radio时,由radio-group触发
  289. radioGroupChange(e) {
  290. // console.log(e);
  291. },
  292. //充值
  293. recharge(e) {
  294. },
  295. click(e) {
  296. console.log(e)
  297. },
  298. setmode(item) {
  299. this.value = item.name
  300. if (this.value == '服务包抵扣') {
  301. if (this.serviceList.length == 0) {
  302. uni.showToast({
  303. title: "暂无服务包可用",
  304. icon: "none"
  305. })
  306. this.value = "钱包余额支付"
  307. this.paytype = 2
  308. return false
  309. } else {
  310. this.paytype = 3
  311. this.showservice = true
  312. }
  313. } else if (this.value == '钱包余额支付') {
  314. this.paytype = 2
  315. }
  316. },
  317. collectCoupons(item, index) {
  318. let status = item.coupon_type.some((item, index) => {
  319. return item.product_type == this.infodata.product_type
  320. })
  321. if (!status) {
  322. uni.showToast({
  323. title: "不支持该类型产品",
  324. icon: "none"
  325. })
  326. return false
  327. }
  328. this.norderAmount = this.infodata.total_amount
  329. this.orderAmount = this.infodata.total_amount
  330. if (item.type == 1) {
  331. if (this.infodata.total_amount * 100 < item.min_consume_amount) {
  332. uni.showToast({
  333. title: "满减金额不够",
  334. icon: "none"
  335. })
  336. this.discountshow = false
  337. return false
  338. } else {
  339. this.coupon = item.name
  340. this.couponid = item.id
  341. let price = (this.norderAmount * 100) - item.money
  342. this.norderAmount = price / 100
  343. this.orderAmount = price / 100
  344. this.discountshow = false
  345. this.$forceUpdate()
  346. }
  347. } else if (item.type == 2) {
  348. this.coupon = item.name
  349. this.couponid = item.id
  350. let price = (this.norderAmount * 100) * ((item.discount.substring(0, item.discount.indexOf(".") + 2) - 0) / 10)
  351. this.norderAmount = price / 100
  352. this.orderAmount = price / 100
  353. this.discountshow = false
  354. this.$forceUpdate()
  355. }
  356. },
  357. confirmpay() {
  358. if (this.paytype == 3 && this.serviceid == "") {
  359. uni.showToast({
  360. title: "请选择服务包",
  361. icon: "none"
  362. })
  363. return false
  364. }
  365. if (this.info.balance < this.infodata.total_amount * 100) {
  366. uni.showModal({
  367. title: "错误提示",
  368. content: "余额不足,请先充值",
  369. confirmText: "去充值",
  370. success(res) {
  371. if (res.confirm) {
  372. uni.navigateTo({
  373. url: "../personal/recharge"
  374. })
  375. }
  376. }
  377. })
  378. } else if (this.infodata.product_type == 1) {
  379. uni.requestSubscribeMessage({
  380. tmplIds: ['M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUjax8YXU'],
  381. success: (res) => {
  382. this.payment()
  383. this.popupShow = true
  384. this.show = true
  385. },
  386. fail: (err) => {
  387. this.payment()
  388. this.popupShow = true
  389. this.show = true
  390. }
  391. })
  392. } else if (this.infodata.product_type == 2) {
  393. uni.requestSubscribeMessage({
  394. tmplIds: ['M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUjax8YXU', 'WCkfvW9NkV_oQgLsJJuwoVMF-G0ss9y4SkIgCObZwWA',
  395. 'ZrL4Ag28cW2F1I1gWcnIk-fxNmZNhb-vNsx32j1ulG0'
  396. ],
  397. success: (res) => {
  398. this.payment()
  399. this.popupShow = true
  400. this.show = true
  401. },
  402. fail: (err) => {
  403. this.payment()
  404. this.popupShow = true
  405. this.show = true
  406. }
  407. })
  408. } else if (this.infodata.product_type == 3) {
  409. uni.requestSubscribeMessage({
  410. tmplIds: ['M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUjax8YXU', 'Sg0lKmOexTnxxDzy39E26aNvmc3w4qKUnxl21A9dWns',
  411. 'phcsQ7ZbsJapfmx3NMCha0MrHCqFrgN7BWVneE5OffI'
  412. ],
  413. success: (res) => {
  414. this.payment()
  415. this.popupShow = true
  416. this.show = true
  417. },
  418. fail: (err) => {
  419. this.payment()
  420. this.popupShow = true
  421. this.show = true
  422. }
  423. })
  424. } else if (this.infodata.product_type == 4 || this.infodata.product_type == 5) {
  425. uni.requestSubscribeMessage({
  426. tmplIds: ['M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUjax8YXU', 'Sg0lKmOexTnxxDzy39E26aNvmc3w4qKUnxl21A9dWns',
  427. 'phcsQ7ZbsJapfmx3NMChaxepR9tJFiqbO25P9tujErI'
  428. ],
  429. success: (res) => {
  430. this.payment()
  431. this.popupShow = true
  432. this.show = true
  433. },
  434. fail: (err) => {
  435. this.payment()
  436. this.popupShow = true
  437. this.show = true
  438. }
  439. })
  440. } else if (this.infodata.product_type == 6) {
  441. uni.requestSubscribeMessage({
  442. tmplIds: ['obCFv2gAnl_RaW-OlnZkjCfi6teT3LUaHxxInUkwLbw'],
  443. success: (res) => {
  444. this.payment()
  445. this.popupShow = true
  446. this.show = true
  447. },
  448. fail: (err) => {
  449. this.payment()
  450. this.popupShow = true
  451. this.show = true
  452. }
  453. })
  454. } else {
  455. this.payment()
  456. this.popupShow = true
  457. this.show = true
  458. }
  459. },
  460. getUserInfo: async function() {
  461. let res = await this.$request.post('/api/v1/user/userInfo')
  462. if (res.status == 0) {
  463. this.info = res.data
  464. console.log(this.info)
  465. }
  466. },
  467. payyuyue: async function() {
  468. let res = await this.$request.post("/api/v1/order/appointPlaceOrder", {
  469. product_type: this.infodata.product_type,
  470. docter_id: this.infodata.docter_id,
  471. patient_id: this.infodata.patient_id,
  472. total_amount: this.infodata.total_amount * 100,
  473. organization_id: this.infodata.organization_id,
  474. schedule_date: this.infodata.schedule_date,
  475. time_period_id: this.infodata.time_period_id,
  476. payment_type: this.paytype,
  477. pay_password: this.password,
  478. user_coupon_id: this.couponid,
  479. order_pack_id: this.serviceid
  480. })
  481. if (res.status == 0) {
  482. this.order_id = res.data.order_id
  483. console.log(res)
  484. } else {
  485. uni.showModal({
  486. title: "提示",
  487. content: res.message,
  488. confirmText: "确定",
  489. showCancel: false,
  490. success: (rr) => {
  491. if (rr.confirm) {
  492. this.popupShow = false
  493. this.show = false
  494. this.password = ""
  495. }
  496. }
  497. })
  498. }
  499. },
  500. paypacks: async function() {
  501. let num = ""
  502. if (this.infodata.is_need_insurance) {
  503. num = 1
  504. } else {
  505. num = 0
  506. }
  507. let res = await this.$request.post("/api/v1/order/packPlaceOrder", {
  508. patient_id: this.infodata.patient_id,
  509. total_amount: this.infodata.total_amount * 100,
  510. service_pack_id: this.infodata.service_pack_id,
  511. is_security: this.infodata.is_security,
  512. guardian_name: this.infodata.guardian_name,
  513. relationship_type: this.infodata.relationship_type,
  514. payment_type: this.infodata.payment_type,
  515. pay_password: this.password,
  516. user_coupon_id: this.couponid,
  517. is_need_insurance: num,
  518. team_id: this.infodata.team_id
  519. })
  520. console.log(res)
  521. if (res.status == 0) {
  522. this.order_id = res.data.order_id
  523. } else {
  524. uni.showModal({
  525. title: "提示",
  526. content: res.message,
  527. confirmText: "确定",
  528. showCancel: false,
  529. success: (rr) => {
  530. if (rr.confirm) {
  531. this.popupShow = false
  532. this.show = false
  533. this.password = ""
  534. }
  535. }
  536. })
  537. }
  538. },
  539. payphone: async function() {
  540. let res = await this.$request.post("/api/v1/order/consultPlaceOrder", {
  541. product_type: this.infodata.product_type,
  542. docter_id: this.infodata.docter_id,
  543. patient_id: this.infodata.patient_id,
  544. total_amount: this.infodata.total_amount * 100,
  545. phone: this.infodata.phone,
  546. phone_minutes: this.infodata.phone_minutes,
  547. payment_type: this.paytype,
  548. pay_password: this.password,
  549. user_coupon_id: this.couponid,
  550. order_pack_id: this.serviceid
  551. })
  552. if (res.status == 0) {
  553. this.order_id = res.data.order_id
  554. console.log(res)
  555. } else {
  556. uni.showModal({
  557. title: "提示",
  558. content: res.message,
  559. confirmText: "确定",
  560. showCancel: false,
  561. success: (rr) => {
  562. if (rr.confirm) {
  563. this.popupShow = false
  564. this.show = false
  565. this.password = ""
  566. }
  567. }
  568. })
  569. }
  570. },
  571. paychat: async function() {
  572. let res = await this.$request.post("/api/v1/order/consultPlaceOrder", {
  573. product_type: this.infodata.product_type,
  574. docter_id: this.infodata.docter_id,
  575. patient_id: this.infodata.patient_id,
  576. total_amount: this.infodata.total_amount * 100,
  577. symptoms: this.infodata.symptoms,
  578. medical_imgs: JSON.stringify(this.infodata.medical_imgs),
  579. payment_type: this.paytype,
  580. pay_password: this.password,
  581. user_coupon_id: this.couponid,
  582. order_pack_id: this.serviceid
  583. })
  584. if (res.status == 0) {
  585. this.order_id = res.data.order_id
  586. } else {
  587. uni.showModal({
  588. title: "提示",
  589. content: res.message,
  590. confirmText: "确定",
  591. showCancel: false,
  592. success: (rr) => {
  593. if (rr.confirm) {
  594. this.popupShow = false
  595. this.show = false
  596. this.password = ""
  597. }
  598. }
  599. })
  600. }
  601. },
  602. payvaccines: async function() {
  603. let res = await this.$request.post("/api/v1/order/appointPlaceOrder", {
  604. product_type: this.infodata.product_type,
  605. patient_id: this.infodata.patient_id,
  606. total_amount: this.infodata.total_amount * 100,
  607. organization_id: this.infodata.organization_id,
  608. schedule_date: this.infodata.schedule_date,
  609. time_period_id: this.infodata.time_period_id,
  610. vaccine_id: this.infodata.vaccine_id,
  611. payment_type: this.paytype,
  612. pay_password: this.password,
  613. user_coupon_id: this.couponid,
  614. order_pack_id: this.serviceid
  615. })
  616. if (res.status == 0) {
  617. this.order_id = res.data.order_id
  618. } else {
  619. uni.showModal({
  620. title: "提示",
  621. content: res.message,
  622. confirmText: "确定",
  623. showCancel: false,
  624. success: (rr) => {
  625. if (rr.confirm) {
  626. this.popupShow = false
  627. this.show = false
  628. this.password = ""
  629. }
  630. }
  631. })
  632. }
  633. },
  634. paychildcare: async function() {
  635. console.log(this.infodata.nurse_ids)
  636. let res = await this.$request.post("/api/v1/order/appointPlaceOrder", {
  637. product_type: this.infodata.product_type,
  638. patient_id: this.infodata.patient_id,
  639. total_amount: this.infodata.total_amount * 100,
  640. organization_id: this.infodata.organization_id,
  641. schedule_date: this.infodata.schedule_date,
  642. time_period_id: this.infodata.time_period_id,
  643. nurse_ids: JSON.stringify(this.infodata.nurse_ids),
  644. payment_type: this.paytype,
  645. pay_password: this.password,
  646. user_coupon_id: this.couponid,
  647. order_pack_id: this.serviceid
  648. })
  649. console.log(res)
  650. if (res.status == 0) {
  651. this.order_id = res.data.order_id
  652. } else {
  653. uni.showModal({
  654. title: "提示",
  655. content: res.message,
  656. confirmText: "确定",
  657. showCancel: false,
  658. success: (rr) => {
  659. if (rr.confirm) {
  660. this.popupShow = false
  661. this.show = false
  662. this.password = ""
  663. }
  664. }
  665. })
  666. }
  667. },
  668. //点击确认支付
  669. payment(e) {
  670. if (this.infodata.product_type == 1) {
  671. this.payphone()
  672. } else if (this.infodata.product_type == 2) {
  673. this.paychat()
  674. } else if (this.infodata.product_type == 6) {
  675. this.paypacks()
  676. } else if (this.infodata.product_type == 3) {
  677. this.payyuyue()
  678. } else if (this.infodata.product_type == 4) {
  679. this.payvaccines()
  680. } else if (this.infodata.product_type == 5) {
  681. this.paychildcare()
  682. }
  683. },
  684. orderPay: async function() {
  685. let res = await this.$request.post("/api/v1/order/orderPay", {
  686. order_id: this.order_id,
  687. pay_password: this.password
  688. })
  689. if (res.status == 0) {
  690. this.popupShow = false
  691. this.show = false
  692. uni.showToast({
  693. title: "支付成功!",
  694. duration: 1500
  695. })
  696. setTimeout(() => {
  697. uni.redirectTo({
  698. url: "order?type=" + this.infodata.product_type
  699. })
  700. }, 1500)
  701. } else {
  702. if (res.message == '密码错误') {
  703. uni.showModal({
  704. title: "提示",
  705. content: res.message,
  706. confirmText: "重试",
  707. success: (res) => {
  708. if (res.confirm) {
  709. this.password = ""
  710. } else if (res.cancel) {
  711. this.popupShow = false
  712. this.show = false
  713. this.password = ""
  714. }
  715. },
  716. })
  717. } else if (res.message == '未设置支付密码') {
  718. uni.showModal({
  719. title: "提示",
  720. content: res.message,
  721. confirmText: "设置",
  722. success: (res) => {
  723. if (res.confirm) {
  724. this.password = ""
  725. uni.navigateTo({
  726. url: "../index/paypassword"
  727. })
  728. } else if (res.cancel) {
  729. this.popupShow = false
  730. this.show = false
  731. this.password = ""
  732. }
  733. },
  734. })
  735. } else {
  736. uni.showModal({
  737. title: "提示",
  738. content: res.message,
  739. confirmText: "确定",
  740. showCancel: false,
  741. success: (rr) => {
  742. if (rr.confirm) {
  743. this.popupShow = false
  744. this.show = false
  745. this.password = ""
  746. }
  747. }
  748. })
  749. }
  750. }
  751. },
  752. // 按键被点击(点击退格键不会触发此事件)
  753. valChange(val) {
  754. // 将每次按键的值拼接到value变量中,注意+=写法
  755. this.password += val;
  756. if (this.password.charAt(0) != '0') {
  757. if (this.password.length == 6) {
  758. this.orderPay()
  759. }
  760. } else {
  761. this.password = ''
  762. uni.showToast({
  763. title: "密码不能以0开头",
  764. icon: "none"
  765. })
  766. }
  767. },
  768. // 退格键被点击
  769. backspace() {
  770. // 删除value的最后一个字符
  771. if (this.password.length) this.password = this.password.substr(0, this.password.length - 1);
  772. console.log(this.password);
  773. }
  774. },
  775. onHide() {
  776. this.popupShow = false
  777. },
  778. }
  779. </script>
  780. <style lang="scss">
  781. .card {
  782. width: 100%;
  783. height: auto;
  784. margin-top: 20rpx;
  785. // background-image: url(../../static/服务包.png);
  786. .taocan {
  787. width: 710rpx;
  788. height: 230rpx;
  789. position: relative;
  790. display: flex;
  791. border-radius: 10rpx;
  792. background: radial-gradient(circle at right top, transparent 15rpx, #fff 0) top left / 152rpx 51% no-repeat,
  793. radial-gradient(circle at right bottom, transparent 15rpx, #fff 0) bottom left /152rpx 51% no-repeat,
  794. radial-gradient(circle at left top, transparent 15rpx, #fff 0) top right /560rpx 51% no-repeat,
  795. radial-gradient(circle at left bottom, transparent 15rpx, #fff 0) bottom right /560rpx 51% no-repeat;
  796. filter: drop-shadow(0rpx 2rpx 12rpx 0rpx rgba(0, 0, 0, 0.04));
  797. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  798. }
  799. }
  800. .tc_left {
  801. display: flex;
  802. justify-content: center;
  803. align-items: center;
  804. width: 152rpx;
  805. text {
  806. font-size: 30rpx;
  807. font-weight: bold;
  808. }
  809. }
  810. .tc_right {
  811. display: flex;
  812. flex-direction: column;
  813. justify-content: center;
  814. width: 550rpx;
  815. padding: 0 20rpx;
  816. font-size: 26rpx;
  817. .text {
  818. padding: 10rpx 0rpx;
  819. width: 100%;
  820. }
  821. }
  822. /* 支付文字 */
  823. .paymentText {
  824. height: 60rpx;
  825. width: auto;
  826. background-color: #FFFFFF;
  827. padding: 30rpx 0 0 30rpx;
  828. font-size: 24rpx;
  829. }
  830. /* 优惠券样式 */
  831. .discount {
  832. position: relative;
  833. display: inline-block;
  834. margin-right: 5px;
  835. margin-left: 15px;
  836. padding: 0 9px 0 12px;
  837. border-top: 1px solid rgb(11, 115, 186);
  838. border-bottom: 1px solid rgb(11, 115, 186);
  839. height: 16px;
  840. line-height: 16px;
  841. color: rgb(11, 115, 186);
  842. font-size: 10px;
  843. }
  844. .discount::before {
  845. content: "";
  846. left: 0;
  847. width: 7px;
  848. position: absolute;
  849. top: -1px;
  850. height: 18px;
  851. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAkCAMAAACpD3pbAAAAPFBMVEUAAAD////kOTzqaGr+9vb4zc32vL3sdXfnTE/mRUfxmpz87O3yn6HqZ2npXWDlQEP97e33xsf3xsbxl5nHV2NIAAAAAXRSTlMAQObYZgAAAJpJREFUOMvllEsSwiAQRMnjF8g/3v+uKhIrjhHK0l16B4+C7hlALS07qSyS2kVlKnHmCpqdNvwYwTdY6yKGX7AeKtb+jmN3jLuYMMEd5XYBUMZ6cO/BHHhr7ut6wizxHOhvM+kUT5S5I77ZsGWU1kbsExsmiSdMBVc3l9a0tJaDdR+CVcryWtRBFLXYkku1oae955Xnv5Y+j/UKs1MGwyraxf4AAAAASUVORK5CYII=);
  852. background-size: 15px 18px;
  853. background-repeat: no-repeat;
  854. }
  855. .discount::after {
  856. right: 0;
  857. width: 4px;
  858. background-position: -11px 0;
  859. content: "";
  860. position: absolute;
  861. top: -1px;
  862. height: 18px;
  863. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAkCAMAAACpD3pbAAAAPFBMVEUAAAD////kOTzqaGr+9vb4zc32vL3sdXfnTE/mRUfxmpz87O3yn6HqZ2npXWDlQEP97e33xsf3xsbxl5nHV2NIAAAAAXRSTlMAQObYZgAAAJpJREFUOMvllEsSwiAQRMnjF8g/3v+uKhIrjhHK0l16B4+C7hlALS07qSyS2kVlKnHmCpqdNvwYwTdY6yKGX7AeKtb+jmN3jLuYMMEd5XYBUMZ6cO/BHHhr7ut6wizxHOhvM+kUT5S5I77ZsGWU1kbsExsmiSdMBVc3l9a0tJaDdR+CVcryWtRBFLXYkku1oae955Xnv5Y+j/UKs1MGwyraxf4AAAAASUVORK5CYII=);
  864. background-size: 15px 18px;
  865. background-repeat: no-repeat;
  866. }
  867. /* 优惠头部 */
  868. .header-Discount {
  869. position: relative;
  870. height: 46px;
  871. line-height: 46px;
  872. padding-left: 10px;
  873. font-size: 15px;
  874. color: #333;
  875. text-align: center;
  876. font-weight: 700;
  877. }
  878. .body-Discount {
  879. padding: 0 18px;
  880. font-size: 13px;
  881. color: #333;
  882. margin-bottom: 50px;
  883. }
  884. .body-Discount>.collar {
  885. position: relative;
  886. padding-bottom: 9px;
  887. }
  888. .body-Discount>.collar>.title-Discount {
  889. height: 40px;
  890. line-height: 40px;
  891. color: #262626;
  892. font-weight: 700;
  893. }
  894. .body-Discount>.collar .couponList>.couponItem {
  895. color: rgb(11, 115, 186);
  896. margin-bottom: 18px;
  897. padding: 12px 10px;
  898. border-top: 6px solid currentColor;
  899. box-shadow: 0 0 6px 0 rgba(0, 0, 0, .1);
  900. border-radius: 6px;
  901. }
  902. .body-Discount>.collar .couponList>.couponItem>.couponItem-subject {
  903. display: flex;
  904. min-height: 58px;
  905. color: rgb(11, 115, 186);
  906. }
  907. .body-Discount>.collar .couponList>.couponItem>.couponItem-subject>.couponItem-subject-left {
  908. width: 220rpx;
  909. margin-right: 10px;
  910. line-height: 1;
  911. text-align: center;
  912. display: flex;
  913. flex-direction: column;
  914. justify-content: center;
  915. overflow: hidden;
  916. }
  917. .couponItem-subject-price {
  918. overflow: hidden;
  919. text-overflow: ellipsis;
  920. white-space: nowrap;
  921. line-height: 1;
  922. text-align: center;
  923. }
  924. .couponItem-subject-icon {
  925. font-size: 14px;
  926. display: inline-block;
  927. vertical-align: bottom;
  928. margin: 0 4px 3px 0;
  929. }
  930. .couponItem-subject-price-min {
  931. position: relative;
  932. top: 1px;
  933. font-size: 36px;
  934. letter-spacing: 0;
  935. }
  936. .couponItem-subject-price-reduce {
  937. font-size: 14px;
  938. margin-top: 5px;
  939. }
  940. .couponItem-subject-right {
  941. flex: 1;
  942. position: relative;
  943. }
  944. .couponItem-subject-right-header {
  945. height: 36px;
  946. line-height: 18px;
  947. overflow: hidden;
  948. text-overflow: ellipsis;
  949. display: -webkit-box;
  950. -webkit-line-clamp: 1;
  951. -webkit-box-orient: vertical;
  952. font-size: 12px;
  953. color: #666;
  954. }
  955. .couponItem-subject-right-header-icon {
  956. background-color: rgb(11, 115, 186);
  957. color: #fff;
  958. font-size: 12px;
  959. display: inline-block;
  960. padding: 0 6px 0 12px;
  961. height: 14px;
  962. margin-right: 4px;
  963. line-height: 14px;
  964. position: relative;
  965. border-radius: 0 3px 3px 0;
  966. }
  967. .couponItem-subject-right-header-icon::before {
  968. position: absolute;
  969. z-index: 1;
  970. content: "";
  971. width: 0;
  972. top: 0;
  973. left: -7px;
  974. height: 0;
  975. border-top: 7px solid #fff;
  976. border-right: 7px solid transparent;
  977. border-bottom: 7px solid #fff;
  978. border-left: 7px solid #fff;
  979. }
  980. .couponItem-subject-right-header-icon::after {
  981. content: ".";
  982. position: absolute;
  983. color: #fff;
  984. left: 5px;
  985. top: -6px;
  986. font-size: 20px;
  987. }
  988. .couponItem-subject-right-btn {
  989. background-color: rgb(11, 115, 186);
  990. color: #fff;
  991. font-size: 12px;
  992. position: absolute;
  993. right: 0;
  994. bottom: 0;
  995. width: 68px;
  996. height: 20px;
  997. line-height: 20px;
  998. text-align: center;
  999. border-radius: 10px;
  1000. box-sizing: border-box;
  1001. z-index: 2;
  1002. }
  1003. .desc-style {
  1004. padding: 5px 18px 10px 18px;
  1005. line-height: 1.3;
  1006. position: relative;
  1007. font-size: 12px;
  1008. max-height: 46px;
  1009. overflow: hidden;
  1010. color: #666;
  1011. background-color: white;
  1012. }
  1013. .closing-date {
  1014. padding-right: 68px;
  1015. position: absolute;
  1016. left: 0;
  1017. bottom: 0;
  1018. box-sizing: border-box;
  1019. width: 100%;
  1020. line-height: 20px;
  1021. font-size: 10px;
  1022. color: #8c8c8c;
  1023. }
  1024. </style>