cp-jg.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="ayuu">
  3. <view class="cpfapryu">
  4. <view class="indhuyr">
  5. <view class="indjbrr"></view>
  6. <text>测评结果</text>
  7. </view>
  8. <view class="">
  9. </view>
  10. <!-- <text v-if="state==1">支付后查看测评结果</text> -->
  11. <!-- <view class="cpjgtxt">
  12. <view class="mytitles">
  13. <text>项目</text>
  14. <text>值</text>
  15. <text>范围</text>
  16. </view>
  17. <view class="myc">
  18. <view class="mycv" v-for="(item,index) in list" :key="index">
  19. <text>{{item.name}}</text>
  20. <text>{{item.key}}</text>
  21. <text>{{item.value}}</text>
  22. </view>
  23. </view>
  24. </view> -->
  25. </view>
  26. <view class="">
  27. <!-- url="../user/cp-fk" -->
  28. <!-- <view class="cpjgkan" hover-class="none" @click="pay(1)">
  29. <text>解决方案 普通/{{price}}¥</text>
  30. </view>
  31. <view class="cpjgkanb" hover-class="none" @click="pay(2)">
  32. <text>解决方案 会员/{{vip_price}}¥</text>
  33. </view> -->
  34. </view>
  35. </view>
  36. </template>
  37. <style>
  38. page {
  39. background: #FAFAFA;
  40. }
  41. </style>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  46. id:0,
  47. state:1, // 1 待支付 2 已支付
  48. price:0, // 普通价格
  49. vip_price:0, // vip价格
  50. result:[],
  51. pay_res:'',
  52. list:[],
  53. deviceType:'wxapp',
  54. resultText: '',
  55. }
  56. },
  57. onLoad(e) {
  58. // #ifdef APP-PLUS
  59. this.deviceType = 'wxh5'
  60. // #endif
  61. // #ifdef MP-WEIXIN
  62. this.deviceType = 'wxapp'
  63. // #endif
  64. this.id = e.id
  65. this.state = e.state || 1
  66. this.list = JSON.parse(decodeURIComponent(e.list)) || []
  67. // this.getExaminationInfo()
  68. },
  69. methods:{
  70. getResult(){
  71. let that = this;
  72. that.$request.getResult({
  73. log_id: that.id
  74. }).then( res =>{
  75. console.log(res)
  76. if(res.code == 0){
  77. this.resultText = res.data;
  78. }else{
  79. uni.showToast({
  80. title: res.message,
  81. icon: "none",
  82. })
  83. }
  84. }).catch( e =>{
  85. console.log(e)
  86. })
  87. },
  88. // 获取报告内容 获取价格
  89. getExaminationInfo(){
  90. this.$post({
  91. data:{
  92. do:'ExaminationInfo'
  93. }
  94. }).then(res=>{
  95. console.log(res,'bbbbbbbbb')
  96. this.price = res.data.price
  97. this.vip_price = res.data.vip_price
  98. })
  99. },
  100. pay(pay_type){
  101. if(pay_type==2 && uni.getStorageSync('is_vip')==0){
  102. uni.showToast({
  103. title:'您还不是会员',
  104. icon:'none'
  105. })
  106. return
  107. }
  108. this.$post({
  109. data:{
  110. do:'GetExamination',
  111. data:{
  112. id:this.id,
  113. pay_type // 支付类型1=普通用户,2=会员用户
  114. },
  115. deviceType:this.deviceType
  116. }
  117. }).then(res=>{
  118. console.log(res,'kkkkkkkk')
  119. // this.state = res.data.state
  120. // this.result = res.data.data
  121. // this.pay_res = res.data.pay_res
  122. // #ifdef APP-PLUS
  123. uni.requestPayment({
  124. provider: 'wxpay',
  125. orderInfo:res.data.pay_res.orderinfo,
  126. success:()=> {
  127. // uni.showToast({
  128. // title: '支付成功'
  129. // })
  130. // setTimeout(()=>{
  131. // this.state = res.data.state
  132. // this.result = res.data.data
  133. // },1500)
  134. uni.navigateTo({
  135. url:'/pages/user/fkcg?id='+this.id
  136. })
  137. },
  138. fail:(err)=> {
  139. console.log(err)
  140. uni.showToast({
  141. title: '支付失败',
  142. icon: 'error'
  143. })
  144. }
  145. })
  146. // #endif
  147. // #ifdef MP-WEIXIN
  148. uni.requestPayment({
  149. provider: 'wxpay',
  150. ...res.data.pay_res,
  151. success:()=> {
  152. // uni.showToast({
  153. // title: '支付成功'
  154. // })
  155. // setTimeout(()=>{
  156. // this.state = res.data.state
  157. // this.result = res.data.data
  158. // },1500)
  159. uni.navigateTo({
  160. url:'/pages/user/fkcg?id='+this.id
  161. })
  162. },
  163. fail:(err)=> {
  164. console.log(err)
  165. uni.showToast({
  166. title: '支付失败',
  167. icon: 'error'
  168. })
  169. }
  170. })
  171. // #endif
  172. })
  173. }
  174. }
  175. }
  176. </script>
  177. <style>
  178. .mytitles{
  179. display: flex;
  180. align-items: center;
  181. border: 1rpx solid #ebebeb;
  182. }
  183. .mytitles>text{
  184. width: 33.33%;
  185. text-align: center;
  186. padding: 10rpx 0;
  187. }
  188. .myc{
  189. }
  190. .mycv{
  191. display: flex;
  192. align-items: center;
  193. border: 1rpx solid #ebebeb;
  194. }
  195. .mycv>text{
  196. width: 33.33%;
  197. text-align: center;
  198. padding: 10rpx 0;
  199. }
  200. </style>
  201. <style lang="scss" scoped>
  202. </style>