activity.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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. id = typeof(id) != 'undefined'? id : 0;
  91. if(id<=0){
  92. uni.showToast({
  93. title: '活动参数错误',
  94. icon: 'none'
  95. })
  96. setTimeout(function(){
  97. uni.navigateBack({
  98. data: id,
  99. })
  100. }, 1200)
  101. return false;
  102. }
  103. this.getInfo(id)
  104. },
  105. methods: {
  106. navBack(){
  107. location.href = '/pages/temple/index';
  108. },
  109. showMenu(){
  110. },
  111. modalCancel(){
  112. this.showPopup = false;
  113. },
  114. modalConfirm(){
  115. if(this.selectOptionData.value <= 0){
  116. uni.showToast({
  117. title: '请先选择随喜券数',
  118. icon: 'none'
  119. })
  120. return false;
  121. }
  122. uni.navigateTo({
  123. url: '/pages/temple/books?id='+this.info.id+'&num='+this.selectOptionData.value,
  124. })
  125. },
  126. selectOption(data){
  127. this.selectOptionData = data
  128. },
  129. stopSlide() {
  130. return;
  131. },
  132. getInfo(id) {
  133. let _uni = this
  134. uni.showLoading()
  135. this.$request.api('/api/activity/info', {id: id}).then(res => {
  136. uni.hideLoading()
  137. if(res.success == true){
  138. _uni.info = res.data
  139. }
  140. }).catch(err => {
  141. uni.showToast({
  142. title: typeof(err.msg) != 'undefined'? err.msg : '服务器错误',
  143. icon: 'none'
  144. })
  145. })
  146. },
  147. },
  148. }
  149. </script>
  150. <style lang="less" scoped>
  151. .uni-main {
  152. width: 100%;
  153. height: 100%;
  154. background-color: #fff;
  155. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  156. }
  157. .sticky-nav {
  158. position: sticky;
  159. width: 100%;
  160. top: 0;
  161. z-index: 1;
  162. border-bottom: 1rpx solid rgb(229,229,229);
  163. }
  164. .nav-box {
  165. width: 100%;
  166. padding-top: 50rpx;
  167. display: flex;
  168. align-items: center;
  169. background: #fff;
  170. height: 100rpx;
  171. padding-bottom: 50rpx;
  172. /deep/.u-icon{
  173. margin-left: 20rpx!important;
  174. }
  175. .title {
  176. font-size: 38rpx;
  177. color: #000;
  178. width: 100%;
  179. text-align: center;
  180. }
  181. .right-icon {
  182. float: right;
  183. margin-right: 20rpx;
  184. }
  185. }
  186. .uni-header_title {
  187. padding: 10rpx 0rpx;
  188. text-align: center;
  189. font-size: 36rpx;
  190. }
  191. .uni-banner .uin-banner_thumb {
  192. width: 80%;
  193. height: 300rpx;
  194. margin: 0 auto;
  195. display: block;
  196. }
  197. .uni-info .uni-text {
  198. font-size: 32rpx;
  199. margin-bottom: 10rpx;
  200. padding: 0rpx 10rpx;
  201. }
  202. .uni-info .uni-info_time {
  203. padding-top: 20rpx;
  204. }
  205. .uni-info .uni-info_price {
  206. padding-bottom: 20rpx;
  207. border-bottom: 8rpx solid #f1f1f1;
  208. }
  209. .uni-info .uni-info_price .price {
  210. color: #ff7a55;
  211. }
  212. .uni-info .uni-info_stock .kefu {
  213. float: right;
  214. margin-right: 10rpx;
  215. }
  216. .uni-content .header {
  217. padding: 20rpx 10px;
  218. font-size: 36rpx;
  219. font-weight: bold;
  220. text-align: center;
  221. color: #ff7a55;
  222. }
  223. .uni-content .content {
  224. border-top: 8rpx solid #f1f1f1;
  225. }
  226. .uni-content .content {
  227. padding: 10rpx;
  228. }
  229. .uni-buy {
  230. text-align: center;
  231. width: 100%;
  232. position: fixed;
  233. bottom: 0;
  234. background-color: #ccad51;
  235. }
  236. .uni-buy .uni-buy_btn {
  237. font-size: 40rpx;
  238. padding: 20rpx 0rpx;
  239. color: #fff;
  240. }
  241. /* 弹窗 */
  242. .mask {
  243. z-index: 99;
  244. background: rgba(0, 0, 0, 0.6);
  245. position: fixed;
  246. bottom: 0;
  247. right: 0;
  248. left: 0;
  249. top: 0;
  250. }
  251. .tip {
  252. z-index: 999;
  253. min-width: 600rpx;
  254. display: flex;
  255. font-size: 36rpx;
  256. text-align: center;
  257. background: #FFFFFF;
  258. align-items: center;
  259. flex-direction: column;
  260. justify-content: center;
  261. border-radius: 8rpx;
  262. position: fixed;
  263. left: 50%;
  264. top: 50%;
  265. transform: translate(-50%, -50%);
  266. }
  267. .tip .main {
  268. padding: 50rpx 35rpx 20rpx;
  269. }
  270. .tip .count {
  271. width: 100%;
  272. text-align: left;
  273. }
  274. .tip .count .input-box {
  275. color: #666;
  276. background-color: #ccc;
  277. padding: 6rpx 10rpx;
  278. font-weight: bold;
  279. border-radius: 4rpx;
  280. }
  281. .tip .count .tip-input {
  282. display: inline-block;
  283. width: 120rpx;
  284. vertical-align: middle;
  285. }
  286. .tip .options {
  287. margin-top: 30rpx;
  288. text-align: center;
  289. }
  290. .tip .options .option {
  291. border-radius: 4rpx;
  292. background-color: #ccc;
  293. padding: 6rpx 10rpx;
  294. width: 26%;
  295. margin: 10rpx 3%;
  296. text-align: center;
  297. font-weight: bold;
  298. color: #666;
  299. display: inline-block;
  300. }
  301. .tip .options .option.active {
  302. background-color: #ccad51;
  303. }
  304. .tip .bottom {
  305. width: 100%;
  306. position: relative;
  307. bottom: 0;
  308. }
  309. .tip .bottom .btn {
  310. width: 50%;
  311. display: inline-block;
  312. border: 1px solid #ccc;
  313. padding: 10rpx 0rpx;
  314. font-weight: bold;
  315. }
  316. .tip .bottom .btn.cancel {
  317. border-bottom-left-radius: 8rpx;
  318. }
  319. .tip .bottom .btn.confirm {
  320. color: red;
  321. border-bottom-right-radius: 8rpx;
  322. }
  323. </style>