detail.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view>
  3. <view style="background-color: #FFFFFF;">
  4. <view >
  5. <image :src="$method.splitImgHost(detail.coverUrl)" style="height: 461rpx;width: 100%;"></image>
  6. <view style="padding:20rpx">
  7. <view style="display: flex;margin-top: 13rpx;">
  8. <view class="yearTag">{{detail.year}}</view>
  9. <view class="titleTag">{{detail.goodsName}}</view>
  10. </view>
  11. <view style="display: flex;justify-content: space-between;margin-top: 13rpx;">
  12. <view class="noteTag"><image src="/static/icon/wk_icon1.png" class="wk_icon"></image>
  13. 共 <text class="blackFont">6</text> 科 <text class="blackFont">120</text> 节 <text class="blackFont">60</text> 学时</view>
  14. </view>
  15. </view>
  16. </view>
  17. <u-line color="#D6D6DB" />
  18. <view>
  19. <view style="width: 160px;margin: 0 auto;"><u-tabs :list="list" item-width="150" font-size="24" bar-width="110" :current="current" @change="change" active-color="#007AFF"></u-tabs></view>
  20. </view>
  21. <u-line color="#D6D6DB" />
  22. </view>
  23. <view style="padding: 20rpx;" v-show="current==0">
  24. <view class="content">
  25. <view v-html="detail.mobileDetailHtml"></view>
  26. </view>
  27. </view>
  28. <view style="padding: 20rpx;" v-show="current==1">
  29. <view >
  30. <view v-for="(item,index) in courseList" class="courseItem">
  31. <view>{{item.courseName}}</view>
  32. <view><u-icon name="arrow-down" ></u-icon></view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="bottomBox">
  37. <view class="priceTag">¥ {{detail.standPrice}}</view>
  38. <view style="display: flex;color: #FFFFFF;align-items: center;">
  39. <view class="btn1" @click="addCart">加购物车</view>
  40. <view class="btn2" @click="buy">立即购买</view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import { mapGetters } from 'vuex';
  47. export default {
  48. data() {
  49. return {
  50. id:0,
  51. list: [
  52. {
  53. name: '详情'
  54. },
  55. {
  56. name: '大纲'
  57. }
  58. ],
  59. current:0,
  60. detail:{},
  61. courseList:[]
  62. };
  63. },
  64. onUnload() {
  65. },
  66. computed: { ...mapGetters(['userInfo']) },
  67. onLoad(option) {
  68. this.id = option.id;
  69. this.getDetail()
  70. this.goodsCourseList()
  71. },
  72. onShow() {
  73. },
  74. methods: {
  75. addShopCart() {
  76. let self = this
  77. this.$api.addCart({goodsId:this.id}).then(res => {
  78. if(res.data.code==200){
  79. uni.showToast({
  80. title: '添加成功'
  81. });
  82. }else{
  83. this.$u.toast(res.data.msg);
  84. }
  85. });
  86. },
  87. goodsCourseList() {
  88. let self = this
  89. this.$api.goodsCourseList(this.id).then(res => {
  90. if(res.data.code==200){
  91. self.courseList = res.data.rows
  92. }
  93. });
  94. },
  95. getDetail() {
  96. let self = this
  97. this.$api.goodsDetail(this.id).then(res => {
  98. if(res.data.code==200){
  99. self.detail = res.data.data
  100. console.log(self.detail.mobileDetailHtml)
  101. }
  102. });
  103. },
  104. buy(){
  105. if(this.$method.isGoLogin()){
  106. return
  107. }
  108. this.$navTo.togo('/pages2/order/confirm_list');
  109. },
  110. addCart(){
  111. if(this.$method.isGoLogin()){
  112. return
  113. }
  114. this.addShopCart()
  115. },
  116. open(item){
  117. item.showChildren = !item.showChildren
  118. },
  119. change(index){
  120. this.current = index;
  121. }
  122. }
  123. };
  124. </script>
  125. <style >
  126. page{
  127. background-color: #EAEEF1;
  128. }
  129. </style>
  130. <style scope>
  131. .courseItem{
  132. width: 100%;
  133. height: 80rpx;
  134. background: #FFFFFF;
  135. border-radius: 16rpx;
  136. color: #333333;
  137. font-size: 32rpx;
  138. line-height: 80rpx;
  139. font-weight: bold;
  140. padding: 0 10rpx;
  141. display: flex;
  142. justify-content: space-between;
  143. }
  144. .content{
  145. background-color: #FFFFFF;
  146. }
  147. .btn2{
  148. width: 200rpx;
  149. height: 64rpx;
  150. background: linear-gradient(0deg, #FFB102, #FD644F);
  151. box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
  152. border-radius: 32rpx;
  153. line-height: 64rpx;
  154. text-align: center;
  155. }
  156. .btn1{
  157. width: 200rpx;
  158. height: 64rpx;
  159. background: linear-gradient(0deg, #015EEA, #00C0FA);
  160. border-radius: 32rpx;
  161. line-height: 64rpx;
  162. text-align: center;
  163. margin-right: 20rpx;
  164. }
  165. .bottomBox{
  166. position: fixed;
  167. bottom: 0;
  168. width: 100%;
  169. left: 0;
  170. height:98rpx ;
  171. background-color: #FFFFFF;
  172. display: flex;
  173. justify-content: space-between;
  174. align-items: center;
  175. padding: 0 30rpx;
  176. }
  177. .blackFont{
  178. color: #333333;
  179. margin: 0 4rpx;
  180. }
  181. .wk_icon{
  182. width: 24rpx;
  183. height: 24rpx;
  184. margin-right: 12rpx;
  185. }
  186. .noteTag{
  187. ont-size: 24rpx;
  188. font-family: PingFang SC;
  189. font-weight: 500;
  190. color: #999999;
  191. align-items: center;
  192. }
  193. .priceTag{
  194. font-size: 30rpx;
  195. font-family: PingFang SC;
  196. font-weight: bold;
  197. color: #FF2D55;
  198. }
  199. .titleTag{
  200. font-size: 32rpx;
  201. font-weight: bold;
  202. color: #333333;
  203. margin-left: 8rpx;
  204. }
  205. .yearTag{
  206. width: 80rpx;
  207. height: 32rpx;
  208. background: #EBF5FF;
  209. border: 2rpx solid #007AFF;
  210. border-radius: 16rpx;
  211. font-size: 24rpx;
  212. color: #007AFF;
  213. text-align: center;
  214. line-height: 32rpx;
  215. }
  216. .itemBox{
  217. background: #FFFFFF;
  218. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  219. border-radius: 24rpx;
  220. width: 100%;
  221. padding: 20rpx;
  222. margin-bottom: 20rpx;
  223. }
  224. </style>