payment.vue 32 KB

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