activity.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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. icon: 'none'
  143. })
  144. })
  145. },
  146. },
  147. }
  148. </script>
  149. <style lang="less" scoped>
  150. .uni-main {
  151. width: 100%;
  152. height: 100%;
  153. background-color: #fff;
  154. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  155. }
  156. .sticky-nav {
  157. position: sticky;
  158. width: 100%;
  159. top: 0;
  160. z-index: 1;
  161. border-bottom: 1rpx solid rgb(229,229,229);
  162. }
  163. .nav-box {
  164. width: 100%;
  165. padding-top: 50rpx;
  166. display: flex;
  167. align-items: center;
  168. background: #fff;
  169. height: 100rpx;
  170. padding-bottom: 50rpx;
  171. /deep/.u-icon{
  172. margin-left: 20rpx!important;
  173. }
  174. .title {
  175. font-size: 38rpx;
  176. color: #000;
  177. width: 100%;
  178. text-align: center;
  179. }
  180. .right-icon {
  181. float: right;
  182. margin-right: 20rpx;
  183. }
  184. }
  185. .uni-header_title {
  186. padding: 10rpx 0rpx;
  187. text-align: center;
  188. font-size: 36rpx;
  189. }
  190. .uni-banner .uin-banner_thumb {
  191. width: 80%;
  192. height: 300rpx;
  193. margin: 0 auto;
  194. display: block;
  195. }
  196. .uni-info .uni-text {
  197. font-size: 32rpx;
  198. margin-bottom: 10rpx;
  199. padding: 0rpx 10rpx;
  200. }
  201. .uni-info .uni-info_time {
  202. padding-top: 20rpx;
  203. }
  204. .uni-info .uni-info_price {
  205. padding-bottom: 20rpx;
  206. border-bottom: 8rpx solid #f1f1f1;
  207. }
  208. .uni-info .uni-info_price .price {
  209. color: #ff7a55;
  210. }
  211. .uni-info .uni-info_stock .kefu {
  212. float: right;
  213. margin-right: 10rpx;
  214. }
  215. .uni-content .header {
  216. padding: 20rpx 10px;
  217. font-size: 36rpx;
  218. font-weight: bold;
  219. text-align: center;
  220. color: #ff7a55;
  221. }
  222. .uni-content .content {
  223. border-top: 8rpx solid #f1f1f1;
  224. }
  225. .uni-content .content {
  226. padding: 10rpx;
  227. }
  228. .uni-buy {
  229. text-align: center;
  230. width: 100%;
  231. position: fixed;
  232. bottom: 0;
  233. background-color: #ccad51;
  234. }
  235. .uni-buy .uni-buy_btn {
  236. font-size: 40rpx;
  237. padding: 20rpx 0rpx;
  238. color: #fff;
  239. }
  240. /* 弹窗 */
  241. .mask {
  242. z-index: 99;
  243. background: rgba(0, 0, 0, 0.6);
  244. position: fixed;
  245. bottom: 0;
  246. right: 0;
  247. left: 0;
  248. top: 0;
  249. }
  250. .tip {
  251. z-index: 999;
  252. min-width: 600rpx;
  253. display: flex;
  254. font-size: 36rpx;
  255. text-align: center;
  256. background: #FFFFFF;
  257. align-items: center;
  258. flex-direction: column;
  259. justify-content: center;
  260. border-radius: 8rpx;
  261. position: fixed;
  262. left: 50%;
  263. top: 50%;
  264. transform: translate(-50%, -50%);
  265. }
  266. .tip .main {
  267. padding: 50rpx 35rpx 20rpx;
  268. }
  269. .tip .count {
  270. width: 100%;
  271. text-align: left;
  272. }
  273. .tip .count .input-box {
  274. color: #666;
  275. background-color: #ccc;
  276. padding: 6rpx 10rpx;
  277. font-weight: bold;
  278. border-radius: 4rpx;
  279. }
  280. .tip .count .tip-input {
  281. display: inline-block;
  282. width: 120rpx;
  283. vertical-align: middle;
  284. }
  285. .tip .options {
  286. margin-top: 30rpx;
  287. text-align: center;
  288. }
  289. .tip .options .option {
  290. border-radius: 4rpx;
  291. background-color: #ccc;
  292. padding: 6rpx 10rpx;
  293. width: 26%;
  294. margin: 10rpx 3%;
  295. text-align: center;
  296. font-weight: bold;
  297. color: #666;
  298. display: inline-block;
  299. }
  300. .tip .options .option.active {
  301. background-color: #ccad51;
  302. }
  303. .tip .bottom {
  304. width: 100%;
  305. position: relative;
  306. bottom: 0;
  307. }
  308. .tip .bottom .btn {
  309. width: 50%;
  310. display: inline-block;
  311. border: 1px solid #ccc;
  312. padding: 10rpx 0rpx;
  313. font-weight: bold;
  314. }
  315. .tip .bottom .btn.cancel {
  316. border-bottom-left-radius: 8rpx;
  317. }
  318. .tip .bottom .btn.confirm {
  319. color: red;
  320. border-bottom-right-radius: 8rpx;
  321. }
  322. </style>