payment.vue 31 KB

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