evaluate.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <view class="content">
  3. <view class="equity_box">
  4. <view class="text-box uni-textarea">
  5. <textarea auto-height placeholder-style="color:#999" maxlength="-1" :placeholder="placeholder" @blur="bindTextAreaBlur"></textarea>
  6. </view>
  7. <view class="flex_item zhil">
  8. <view>评分</view>
  9. <view><uniRate text="1" size="20" margin="10" :value="rateValue" @change="rateChange"></uniRate></view>
  10. </view>
  11. </view>
  12. <view @click.stop="submit" class="submit-btn">提交评论</view>
  13. <!-- 打赏金额弹出层 -->
  14. <uni-popup ref="popup" type="center">
  15. <view class="popup">
  16. <view class="row">
  17. <view class="row-1">给医生打打赏吧</view>
  18. <input class="row-2" type="number" v-model="money" placeholder="请输入打赏金额" />
  19. <button class="row-3 flex" @click="Reward">立即打赏</button>
  20. <view class="close_icon" @click="close">残忍跳过</view>
  21. </view>
  22. </view>
  23. </uni-popup>
  24. <!-- 支付弹窗 -->
  25. <uni-popup ref="popup2" style="z-index: 999;" type="bottom">
  26. <view class="payment">
  27. <view class="first flex " @click="payclose()">
  28. <text class="word">选择支付方式</text>
  29. <image src="../../static/img/img25.png"></image>
  30. </view>
  31. <view class="pay-type-list">
  32. <view class="type-item b-b" @click="changePayType(1)">
  33. <view class="img"><image class="yue" src="../../static/img/img26.png"></image></view>
  34. <view class="con"><text class="tit">微信支付</text></view>
  35. <label class="radio"><radio value="" color="#FC4141" :checked="payType == 1"></radio></label>
  36. </view>
  37. <view class="type-item flex_item" @click="changePayType(2)">
  38. <view class="img"><image class="yue" src="../../static/img/img017.png"></image></view>
  39. <view class="con"><text class="tit">余额支付</text></view>
  40. <label class="radio"><radio value="" color="#FC4141" :checked="payType == 2"></radio></label>
  41. </view>
  42. </view>
  43. <view class="one"></view>
  44. <view class="Third flex">
  45. <view class="two1">
  46. <text class="two1-1 ">合计:</text>
  47. <text class="two1-2">¥</text>
  48. <text class="two1-2 size">{{ money }}</text>
  49. </view>
  50. <view class="two2" :class="{ clickbg: payLoding }" @click.stop="!payLoding ? confirm() : ''"><text>立即支付</text></view>
  51. </view>
  52. </view>
  53. </uni-popup>
  54. </view>
  55. </template>
  56. <script>
  57. import { comment } from '@/api/patient.js';
  58. import uniRate from '@/components/uni-rate/uni-rate.vue';
  59. import { reward } from '@/api/patient.js';
  60. export default {
  61. components: {
  62. uniRate
  63. },
  64. data() {
  65. return {
  66. order_id: '', //订单id
  67. text: '', //评论内容
  68. rateValue: '', //评分
  69. placeholder: '说说你的就医体验,分享给更多的病友吧',
  70. money:'',
  71. payType: 1, //支付类型
  72. payLoding: false, //判断是否支付中
  73. // #ifdef H5
  74. froms: '', //当前是否为微信浏览器
  75. // #endif
  76. type: '', //判断是否从订单中进入
  77. };
  78. },
  79. onLoad(option) {
  80. this.order_id = option.id;
  81. },
  82. onShow() {},
  83. methods: {
  84. //评论内容
  85. bindTextAreaBlur: function(e) {
  86. this.text = e.detail.value;
  87. },
  88. //评分
  89. rateChange(val) {
  90. this.rateValue = val.value;
  91. },
  92. //提交评论
  93. submit(e) {
  94. let obj = this;
  95. console.log(obj.text, 22);
  96. obj.open();
  97. comment({
  98. comment: obj.text,
  99. score: obj.rateValue,
  100. order_id: obj.order_id
  101. })
  102. .then(e => {
  103. obj.open();
  104. })
  105. .catch(e => {
  106. console.log(e.message);
  107. });
  108. },
  109. //打开打赏弹窗
  110. open() {
  111. this.$refs.popup.open();
  112. },
  113. //关闭打赏弹窗
  114. close() {
  115. this.$refs.popup.close();
  116. uni.switchTab({
  117. url: '/pages/patient/patient'
  118. });
  119. },
  120. //立即打赏
  121. Reward() {
  122. if (this.money == '') {
  123. this.$api.msg('请输入打赏金额');
  124. return;
  125. }
  126. this.$refs.popup.close();
  127. this.payopen();
  128. },
  129. //打开支付弹窗
  130. payopen() {
  131. this.$refs.popup2.onTap();
  132. this.$refs.popup2.open();
  133. },
  134. //关闭支付弹窗
  135. payclose() {
  136. this.$refs.popup2.close();
  137. uni.switchTab({
  138. url: '/pages/patient/patient'
  139. });
  140. },
  141. //选择支付方式
  142. changePayType(type) {
  143. this.payType = type;
  144. },
  145. //确认支付
  146. confirm: async function() {
  147. let obj = this;
  148. // 支付中
  149. obj.payLoding = true;
  150. // #ifdef H5
  151. // 获取当前是否为微信浏览器
  152. obj.froms = uni.getStorageSync('weichatBrowser') || '';
  153. // #endif
  154. obj.CreateOrder();
  155. },
  156. //订单创建
  157. CreateOrder() {
  158. let obj = this;
  159. // 生成订单
  160. reward({
  161. order_id: obj.order_id, //
  162. money: obj.money, //医生类型 1 普通预约 2 私人医生
  163. pay_type: obj.payType //支付类型 1是微信 2是余额
  164. })
  165. .then(data => {
  166. // 判断是否为余额支付
  167. if (obj.payType == 2) {
  168. if (data.code == 200) {
  169. if (data.msg == '余额支付成功') {
  170. obj.$api.msg('打赏成功');
  171. setTimeout(function() {
  172. uni.switchTab({
  173. url: '/pages/patient/patient'
  174. });
  175. }, 1000);
  176. }
  177. obj.loadData('Refresh');
  178. obj.payLoding = false;
  179. } else {
  180. obj.payLoding = false;
  181. obj.$api.msg(msg);
  182. }
  183. }
  184. if (obj.payType == 1) {
  185. console.log('orderMoneyPay', data);
  186. let item = data.data;
  187. // 立即支付
  188. obj.orderMoneyPay(item);
  189. }
  190. })
  191. .catch(e => {
  192. // 支付完成
  193. console.log(e.message);
  194. obj.payLoding = false;
  195. if (e.message == '该订单已支付!') {
  196. // obj.paySuccessTo();
  197. }
  198. });
  199. },
  200. // 页面跳转
  201. navto(e) {
  202. uni.navigateTo({
  203. url: e
  204. });
  205. }
  206. }
  207. };
  208. </script>
  209. <style lang="scss">
  210. page {
  211. background: #f8f6f6;
  212. height: 100%;
  213. .content {
  214. background: #f8f6f6;
  215. height: 100%;
  216. padding-top: 25rpx;
  217. }
  218. }
  219. .zhil {
  220. font-size: 28rpx !important;
  221. padding: 15rpx 15rpx;
  222. margin-top: 25rpx;
  223. }
  224. .equity_box {
  225. background-color: #ffffff;
  226. padding: 25rpx 25rpx;
  227. .text-box {
  228. min-height: 200rpx;
  229. textarea {
  230. font-size: 25rpx;
  231. width: 100%;
  232. overflow: hidden;
  233. text-overflow: ellipsis;
  234. display: -webkit-box;
  235. -webkit-box-orient: vertical;
  236. -webkit-line-clamp: 5;
  237. }
  238. }
  239. }
  240. .submit-btn {
  241. width: 80%;
  242. padding: 25rpx 0rpx;
  243. margin: 80rpx auto;
  244. text-align: center;
  245. background-color: #6786fb !important;
  246. box-shadow: 0rpx 8rpx 12rpx rgba(0, 0, 0, 0.16);
  247. border-radius: 56rpx;
  248. font-size: 39rpx;
  249. font-weight: bold;
  250. color: rgba(255, 255, 255, 1);
  251. }
  252. //弹窗
  253. .popup {
  254. width: 536rpx;
  255. .img {
  256. width: 100%;
  257. }
  258. .row {
  259. background: #ffffff;
  260. padding: 45rpx 45rpx;
  261. border-radius: 25rpx;
  262. .row-1 {
  263. color: #323333;
  264. font-size: 36rpx;
  265. text-align: center;
  266. width: 100%;
  267. padding: 30rpx 0rpx;
  268. padding-bottom: 50rpx !important;
  269. }
  270. .row-2 {
  271. background: #eaeaea;
  272. padding: 15rpx 25rpx;
  273. font-size: 26rpx;
  274. height: 80rpx;
  275. border-radius: 15rpx;
  276. }
  277. .row-3 {
  278. width: 80%;
  279. margin: 20rpx auto;
  280. margin-top: 50rpx;
  281. background: linear-gradient(0deg, rgba(126, 153, 254, 1), rgba(151, 143, 250, 1));
  282. border-radius: 34rpx;
  283. justify-content: center;
  284. font-size: $uni-font-size-lg + 4rpx;
  285. font-weight: 500;
  286. color: #f8f9f9;
  287. }
  288. .close_icon {
  289. width:100%;
  290. text-align: center;
  291. font-size: 30rpx;
  292. padding-top: 80rpx;
  293. text-decoration:underline;
  294. }
  295. }
  296. }
  297. //支付弹窗
  298. .pay-type-list {
  299. margin-top: 20upx;
  300. background-color: #fff;
  301. padding-left: 40upx;
  302. .type-item {
  303. height: 120upx;
  304. padding: 20upx 0;
  305. display: flex;
  306. justify-content: space-between;
  307. align-items: center;
  308. padding-right: 60upx;
  309. font-size: 30upx;
  310. position: relative;
  311. }
  312. .icon {
  313. width: 100upx;
  314. font-size: 52upx;
  315. }
  316. .img {
  317. color: #fe8e2e;
  318. width: 50rpx;
  319. height: 50rpx;
  320. image {
  321. width: 100%;
  322. height: 100%;
  323. }
  324. }
  325. .tit {
  326. font-size: $font-lg;
  327. color: $font-color-dark;
  328. margin-bottom: 4upx;
  329. }
  330. .con {
  331. flex: 1;
  332. display: flex;
  333. flex-direction: column;
  334. padding-left: 25rpx;
  335. font-size: $font-sm;
  336. color: $font-color-light;
  337. }
  338. }
  339. .payment {
  340. background-color: #ffffff;
  341. border-radius: 15rpx 15rpx 0rpx 0rpx;
  342. z-index: 999;
  343. .first {
  344. border-bottom: 2rpx solid $border-color-light;
  345. padding: 38rpx 25rpx;
  346. .word {
  347. font-size: $uni-font-size-base;
  348. font-weight: bold;
  349. color: $font-color-dark;
  350. }
  351. image {
  352. width: 25rpx;
  353. height: 25rpx;
  354. }
  355. }
  356. .one {
  357. height: 20rpx;
  358. background-color: #f6f6f6;
  359. }
  360. .Third {
  361. .two1 {
  362. width: 55%;
  363. background-color: #ffffff;
  364. padding-left: 25rpx;
  365. .two1-1 {
  366. font-size: $uni-font-size-base;
  367. font-weight: 400;
  368. color: $font-color-dark;
  369. }
  370. .two1-2 {
  371. font-size: $uni-font-size-sm;
  372. font-weight: bold;
  373. color: $color-red1;
  374. }
  375. .size {
  376. font-size: $uni-font-size-lg + 4rpx;
  377. }
  378. }
  379. .two2 {
  380. width: 45%;
  381. background: $color-red1;
  382. color: #ffffff;
  383. font-size: $uni-font-size-lg;
  384. font-weight: 550;
  385. text-align: center;
  386. padding: 30rpx 0rpx;
  387. }
  388. .clickbg {
  389. background-color: $color-gray !important;
  390. }
  391. }
  392. }
  393. </style>