payment.vue 32 KB

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