activity.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <view class="uni-main">
  3. <view class="sticky-nav">
  4. <view class="nav-box">
  5. <u-icon name="arrow-left" color="#000" size="48" @click="navBack()"></u-icon>
  6. <text class="title">寺院活动</text>
  7. <u-icon class="right-icon" name="zhuanfa" color="#000" size="48" @click="showMenu()"></u-icon>
  8. </view>
  9. </view>
  10. <view class="uni-main_box" v-if="info.id">
  11. <view class="uni-header_title">
  12. <text v-text="info.title"></text>
  13. </view>
  14. <view class="uni-banner">
  15. <image class="uin-banner_thumb" :src="info.thumb" width="100" height="120"></image>
  16. </view>
  17. <view class="uni-info">
  18. <view class="uni-text uni-info_time">
  19. 时间: <text class="time" v-text="info.publish_at"></text>
  20. </view>
  21. <view class="uni-text uni-info_price">
  22. <view>费用:<text class="price" v-text="info.price>0?'¥'+info.price: '免费'"></text></view>
  23. </view>
  24. </view>
  25. <view class="uni-content">
  26. <view class="header">
  27. <text class="info_text">活动详情</text>
  28. </view>
  29. <view class="content" v-html="info.content">
  30. </view>
  31. </view>
  32. <view class="uni-buy">
  33. <view class="uni-buy_btn" @click="showPopup=true">
  34. <text v-text="info.type==1? '我要代订': (info.type==2?'我要助印': '我要供奉')"></text>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="specs-box">
  39. <view v-show="showPopup" @touchmove.stop.prevent="stopSlide">
  40. <!-- 遮罩层 -->
  41. <view class="mask" @click="modalCancel"></view>
  42. <!-- 内容区 -->
  43. <view class="tip">
  44. <view class="main">
  45. <view class="count">
  46. 随喜:<text class="input-box"><input class="tip-input" type="text" placeholder="8-3000" disabled="true"/>券</text>
  47. </view>
  48. <view class="options">
  49. <text :class="'option'+(v.value==selectOptionData.value? ' active' : '')" v-for="(v,k) in quanArr" :key="k" v-text="v.name" @click="selectOption(v)"></text>
  50. </view>
  51. </view>
  52. <view class="bottom">
  53. <view class="btn cancel" @click="modalCancel()">取消</view>
  54. <view class="btn confirm" @click="modalConfirm()">确定</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. showPopup: false,
  66. phone: '12345678',
  67. autoplay: true,
  68. adAutoplay: true,
  69. interval: 2000,
  70. adInterval: 4000,
  71. duration: 1000,
  72. adDuration: 500,
  73. info: {
  74. id: 0,
  75. },
  76. selectOptionData: {name: '',value: ''},
  77. quanArr: [
  78. {name: '8券', value: '8'},
  79. {name: '28券', value: '28'},
  80. {name: '58券', value: '58'},
  81. {name: '68券', value: '68'},
  82. {name: '168券', value: '168'},
  83. {name: '268券', value: '268'},
  84. ],
  85. }
  86. },
  87. onLoad(option){
  88. let _uni = this
  89. let id = option.id
  90. if(id<=0){
  91. uni.showToast({
  92. title: '活动参数错误',
  93. icon: 'none'
  94. })
  95. setTimeout(function(){
  96. uni.navigateBack({
  97. data: id,
  98. })
  99. }, 1200)
  100. return false;
  101. }
  102. this.getInfo(id)
  103. },
  104. methods: {
  105. navBack(){
  106. location.href = '/pages/temple/index';
  107. },
  108. showMenu(){
  109. },
  110. modalCancel(){
  111. this.showPopup = false;
  112. },
  113. modalConfirm(){
  114. if(this.selectOptionData.value <= 0){
  115. uni.showToast({
  116. title: '请先选择随喜券数',
  117. icon: 'none'
  118. })
  119. return false;
  120. }
  121. uni.navigateTo({
  122. url: '/pages/temple/books?id='+this.info.id+'&num='+this.selectOptionData.value,
  123. })
  124. },
  125. selectOption(data){
  126. this.selectOptionData = data
  127. },
  128. stopSlide() {
  129. return;
  130. },
  131. getInfo(id) {
  132. let _uni = this
  133. uni.showLoading()
  134. this.$request.api('/api/activity/info', {id: id}).then(res => {
  135. uni.hideLoading()
  136. if(res.success == true){
  137. _uni.info = res.data
  138. }
  139. }).catch(err => {
  140. uni.showToast({
  141. title: typeof(err.msg) != 'undefined'? err.msg : '服务器错误'
  142. })
  143. })
  144. },
  145. },
  146. }
  147. </script>
  148. <style lang="less" scoped>
  149. .uni-main {
  150. width: 100%;
  151. height: 100%;
  152. background-color: #fff;
  153. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  154. }
  155. .sticky-nav {
  156. position: sticky;
  157. width: 100%;
  158. top: 0;
  159. z-index: 1;
  160. border-bottom: 1rpx solid rgb(229,229,229);
  161. }
  162. .nav-box {
  163. width: 100%;
  164. padding-top: 50rpx;
  165. display: flex;
  166. align-items: center;
  167. background: #fff;
  168. height: 100rpx;
  169. padding-bottom: 50rpx;
  170. /deep/.u-icon{
  171. margin-left: 20rpx!important;
  172. }
  173. .title {
  174. font-size: 38rpx;
  175. color: #000;
  176. width: 100%;
  177. text-align: center;
  178. }
  179. .right-icon {
  180. float: right;
  181. margin-right: 20rpx;
  182. }
  183. }
  184. .uni-header_title {
  185. padding: 10rpx 0rpx;
  186. text-align: center;
  187. font-size: 36rpx;
  188. }
  189. .uni-banner .uin-banner_thumb {
  190. width: 80%;
  191. height: 300rpx;
  192. margin: 0 auto;
  193. display: block;
  194. }
  195. .uni-info .uni-text {
  196. font-size: 32rpx;
  197. margin-bottom: 10rpx;
  198. padding: 0rpx 10rpx;
  199. }
  200. .uni-info .uni-info_time {
  201. padding-top: 20rpx;
  202. }
  203. .uni-info .uni-info_price {
  204. padding-bottom: 20rpx;
  205. border-bottom: 8rpx solid #f1f1f1;
  206. }
  207. .uni-info .uni-info_price .price {
  208. color: #ff7a55;
  209. }
  210. .uni-info .uni-info_stock .kefu {
  211. float: right;
  212. margin-right: 10rpx;
  213. }
  214. .uni-content .header {
  215. padding: 20rpx 10px;
  216. font-size: 36rpx;
  217. font-weight: bold;
  218. text-align: center;
  219. color: #ff7a55;
  220. }
  221. .uni-content .content {
  222. border-top: 8rpx solid #f1f1f1;
  223. }
  224. .uni-content .content {
  225. padding: 10rpx;
  226. }
  227. .uni-buy {
  228. text-align: center;
  229. width: 100%;
  230. position: fixed;
  231. bottom: 0;
  232. background-color: #ccad51;
  233. }
  234. .uni-buy .uni-buy_btn {
  235. font-size: 40rpx;
  236. padding: 20rpx 0rpx;
  237. color: #fff;
  238. }
  239. /* 弹窗 */
  240. .mask {
  241. z-index: 99;
  242. background: rgba(0, 0, 0, 0.6);
  243. position: fixed;
  244. bottom: 0;
  245. right: 0;
  246. left: 0;
  247. top: 0;
  248. }
  249. .tip {
  250. z-index: 999;
  251. min-width: 600rpx;
  252. display: flex;
  253. font-size: 36rpx;
  254. text-align: center;
  255. background: #FFFFFF;
  256. align-items: center;
  257. flex-direction: column;
  258. justify-content: center;
  259. border-radius: 8rpx;
  260. position: fixed;
  261. left: 50%;
  262. top: 50%;
  263. transform: translate(-50%, -50%);
  264. }
  265. .tip .main {
  266. padding: 50rpx 35rpx 20rpx;
  267. }
  268. .tip .count {
  269. width: 100%;
  270. text-align: left;
  271. }
  272. .tip .count .input-box {
  273. color: #666;
  274. background-color: #ccc;
  275. padding: 6rpx 10rpx;
  276. font-weight: bold;
  277. border-radius: 4rpx;
  278. }
  279. .tip .count .tip-input {
  280. display: inline-block;
  281. width: 120rpx;
  282. vertical-align: middle;
  283. }
  284. .tip .options {
  285. margin-top: 30rpx;
  286. text-align: center;
  287. }
  288. .tip .options .option {
  289. border-radius: 4rpx;
  290. background-color: #ccc;
  291. padding: 6rpx 10rpx;
  292. width: 26%;
  293. margin: 10rpx 3%;
  294. text-align: center;
  295. font-weight: bold;
  296. color: #666;
  297. display: inline-block;
  298. }
  299. .tip .options .option.active {
  300. background-color: #ccad51;
  301. }
  302. .tip .bottom {
  303. width: 100%;
  304. position: relative;
  305. bottom: 0;
  306. }
  307. .tip .bottom .btn {
  308. width: 50%;
  309. display: inline-block;
  310. border: 1px solid #ccc;
  311. padding: 10rpx 0rpx;
  312. font-weight: bold;
  313. }
  314. .tip .bottom .btn.cancel {
  315. border-bottom-left-radius: 8rpx;
  316. }
  317. .tip .bottom .btn.confirm {
  318. color: red;
  319. border-bottom-right-radius: 8rpx;
  320. }
  321. </style>