payment.vue 34 KB

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