耀实惠小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

286 lines
6.0 KiB

  1. <template>
  2. <view class="pages">
  3. <u-sticky>
  4. <view>
  5. <view class="search"><u-search v-model="keyword" placeholder="请输入要搜索的商品" height="70" :show-action="false" @search="search" /></view>
  6. <!-- 分区 -->
  7. <u-tabs :list="nav_list" :is-scroll="true" :current="status" @change="getGoodsListInfo" bar-width="80" active-color="#01AEEA" font-size="34"></u-tabs>
  8. </view>
  9. </u-sticky>
  10. <!-- <view class="top_bg_text" :style="'background-image: url('+http_img+'top_bg.png)'"> -->
  11. <view class="top_bg_text" :style="'background-image: url('+pageImage+')'">
  12. <!-- <text class="title_max">{{title}}</text>
  13. <text class="title_min">{{title_alt}}</text> -->
  14. </view>
  15. <view class="over_y">
  16. <view class="item_goods" v-for="(item,index) in list" :key="index">
  17. <goods-item :goods="item" thereTo='festivaIActivity'></goods-item>
  18. </view>
  19. </view>
  20. <view class="mask" v-show="show" @click.stop="show=false">
  21. <view class="warp">
  22. <view class="rect" @tap.stop>
  23. <image :src="http_img + 'Bell.png'" mode=""></image>
  24. <text class="info">金卡钻石卡会员尊享</text>
  25. <text class="alt">您现在还不是以上会员不能参与此活动</text>
  26. <button @click="toHome" class="tohome_btn">好的</button>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import config from "@/utils/js/config.js"
  34. export default {
  35. data() {
  36. return {
  37. show: false,
  38. status: '0',
  39. butClass:'1',
  40. nav_list: [
  41. {
  42. name: "全部"
  43. },
  44. ],
  45. payNum:0, // 0 非处方 1处方
  46. http_img: config.img_url,
  47. pageImage: '',
  48. title: "端午特惠专区",
  49. title_alt: "节日快乐!",
  50. list: [],
  51. pageNo: 1,
  52. pageSize: 10,
  53. total: null,
  54. isLock: true,
  55. id: '',
  56. keyword: ''
  57. }
  58. },
  59. onPullDownRefresh() {
  60. this.pageNo= 1;
  61. this.total = null;
  62. this.list = [];
  63. this.getGoodsList();
  64. },
  65. onReachBottom() {
  66. if(this.isLock) {
  67. this.isLock = false;
  68. if(this.total !== null && this.pageNo * this.pageSize >= this.total){
  69. this.$Toast('没有更多数据了哦!');
  70. setTimeout(()=>{
  71. this.isLock = true;
  72. },3000)
  73. return
  74. }
  75. this.pageNo+=1;
  76. this.getGoodsList();
  77. }
  78. },
  79. onLoad(options) {
  80. this.id = options.id;
  81. this.pageImage = options.pageImage
  82. // this.title = options.title
  83. // this.title_alt = options.concert
  84. this.getGoodsList();
  85. this.getButClass();
  86. },
  87. methods: {
  88. getButClass(){
  89. this.$api('getButClassList', {}).then(res => {
  90. this.nav_list = this.nav_list.concat(res.result)
  91. }).catch(err => {
  92. this.$Toast(err.message)
  93. })
  94. },
  95. search () {
  96. this.pageNo = 1
  97. this.pageSize = 9999
  98. this.getGoodsList()
  99. },
  100. getGoodsListInfo(e){
  101. this.status = e;
  102. this.butClass = this.nav_list[e].id;
  103. this.list = [];
  104. this.pageNo = 1;
  105. this.total = null;
  106. this.isLock = true;
  107. this.payNum = e;
  108. this.getGoodsList()
  109. console.log("获取新数据",e)
  110. },
  111. toHome() {
  112. console.log(this.show);
  113. return
  114. uni.switchTab({
  115. url: "/pages/home/home"
  116. })
  117. },
  118. getGoodsList() {
  119. uni.showLoading();
  120. const params = {
  121. pageNo: this.pageNo,
  122. pageSize: this.pageSize,
  123. bottonId:this.id,
  124. title: this.keyword,
  125. payNum:this.payNum,
  126. butClass:this.butClass
  127. }
  128. this.$api('getGoodsList',params).then(res => {
  129. let { code, result, message} = res;
  130. uni.hideLoading();
  131. if(code == 200){
  132. if(this.total == null) {
  133. this.total = result.total;
  134. }
  135. result.records.forEach(item => {
  136. // const picArray= item.pic.split(',')
  137. // item.pic= picArray[0]
  138. if(item.pic!==null){
  139. const picArray=item.pic.split(',')
  140. item.pic= picArray[0]
  141. }else{
  142. item.pic= []
  143. }
  144. })
  145. this.list = !this.keyword ? this.list.concat(result.records) : result.records
  146. }else{
  147. this.$Toast(message);
  148. }
  149. }).catch( err => {
  150. uni.hideLoading();
  151. this.$Toast(err.message);
  152. })
  153. },
  154. }
  155. }
  156. </script>
  157. <style lang="scss" scoped>
  158. .search {
  159. // position: fixed;
  160. width: 100%;
  161. top: 0;
  162. left: 0;
  163. padding: 28rpx;
  164. background: #fff;
  165. z-index: 1;
  166. }
  167. .top_bg_text{
  168. width: 100%;
  169. height: 184rpx;
  170. margin-top: 30rpx;
  171. background-size: 100% 184rpx;
  172. display: flex;
  173. flex-direction: column;
  174. align-items: center;
  175. .title_max{
  176. margin-top: 20rpx;
  177. font-size: 54rpx;
  178. font-weight: bold;
  179. color: #73B8DE;
  180. }
  181. .title_min{
  182. margin-top: 10rpx;
  183. font-size: 28rpx;
  184. color: #73B8DE;
  185. }
  186. }
  187. .pages {
  188. // padding-top: 120rpx;
  189. background-color: #F5F5F5;
  190. .top_img {
  191. margin-top: 30rpx;
  192. margin-bottom: 50rpx;
  193. height: 184rpx;
  194. }
  195. }
  196. .over_y {
  197. overflow-y: auto;
  198. }
  199. .item_goods {
  200. margin: 0 auto;
  201. width: 713rpx;
  202. margin-top: 38rpx;
  203. margin-bottom: 30rpx;
  204. background-color: #FFF;
  205. border-radius: 34rpx;
  206. box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.16);
  207. }
  208. // 遮罩层 内容
  209. .mask{
  210. position: absolute;
  211. top: 0;
  212. left: 0;
  213. width: 100%;
  214. height: 100%;
  215. z-index: 100;
  216. background-color: rgba(0, 0, 0, .5);
  217. }
  218. .warp {
  219. position: absolute;
  220. top: 0;
  221. left: 0;
  222. display: flex;
  223. align-items: center;
  224. justify-content: center;
  225. height: 100%;
  226. width: 750rpx !important;
  227. .rect {
  228. width: 605rpx !important;
  229. height: 614rpx;
  230. border-radius: 16rpx;
  231. background-color: #fff;
  232. display: flex;
  233. flex-direction: column;
  234. align-items: center;
  235. justify-content: center;
  236. image {
  237. margin-top: 50rpx;
  238. width: 241rpx;
  239. height: 232rpx;
  240. }
  241. .info {
  242. font-size: 33rpx;
  243. font-weight: bold;
  244. color: #01AEEA;
  245. margin-top: 54rpx;
  246. }
  247. .alt {
  248. font-size: 28rpx;
  249. color: #707070;
  250. margin-top: 21rpx;
  251. }
  252. .tohome_btn {
  253. width: 440rpx;
  254. height: 94rpx;
  255. margin-top: 44rpx;
  256. margin-bottom: 37rpx;
  257. border-radius: 46rpx;
  258. border: 3rpx solid #01AEEA;
  259. background-color: #fff;
  260. line-height: 94rpx;
  261. text-align: center;
  262. font-size: 30rpx;
  263. font-weight: bold;
  264. color: #01AEEA;
  265. }
  266. }
  267. }
  268. </style>