耀实惠小程序
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.

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