payment.vue 34 KB

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