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

285 lines
5.9 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='integralStore'></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. search () {
  93. this.pageNo = 1
  94. this.getGoodsList()
  95. },
  96. getGoodsListInfo(e){
  97. this.status = e;
  98. this.butClass = this.nav_list[e].id;
  99. this.list = [];
  100. this.pageNo = 1;
  101. this.total = null;
  102. this.isLock = true;
  103. this.payNum = e;
  104. this.getGoodsList()
  105. console.log("获取新数据",e)
  106. },
  107. toHome() {
  108. console.log(this.show);
  109. return
  110. uni.switchTab({
  111. url: "/pages/home/home"
  112. })
  113. },
  114. getGoodsList() {
  115. uni.showLoading();
  116. const params = {
  117. pageNo: this.pageNo,
  118. pageSize: this.pageSize,
  119. bottonId:this.id,
  120. title: this.keyword,
  121. payNum:this.payNum,
  122. butClass:this.butClass
  123. }
  124. this.$api('getGoodsList',params).then(res => {
  125. let { code, result, message} = res;
  126. uni.hideLoading();
  127. if(code == 200){
  128. if(this.total == null) {
  129. this.total = result.total;
  130. }
  131. result.records.forEach(item => {
  132. // const picArray= item.pic.split(',')
  133. // item.pic= picArray[0]
  134. if(item.pic!==null){
  135. const picArray=item.pic.split(',')
  136. item.pic= picArray[0]
  137. }else{
  138. item.pic= []
  139. }
  140. })
  141. // this.list = this.list.concat(result.records);
  142. this.list = !this.keyword ? this.list.concat(result.records) : result.records
  143. console.log(this.list)
  144. }else{
  145. this.$Toast(message);
  146. }
  147. }).catch( err => {
  148. uni.hideLoading();
  149. this.$Toast(err.message);
  150. })
  151. },
  152. }
  153. }
  154. </script>
  155. <style lang="scss" scoped>
  156. .search {
  157. // position: fixed;
  158. width: 100%;
  159. top: 0;
  160. left: 0;
  161. padding: 28rpx;
  162. background: #fff;
  163. z-index: 1;
  164. }
  165. .top_bg_text{
  166. width: 100%;
  167. height: 184rpx;
  168. margin-top: 30rpx;
  169. background-size: 100% 184rpx;
  170. display: flex;
  171. flex-direction: column;
  172. align-items: center;
  173. .title_max{
  174. margin-top: 20rpx;
  175. font-size: 54rpx;
  176. font-weight: bold;
  177. color: #73B8DE;
  178. }
  179. .title_min{
  180. margin-top: 10rpx;
  181. font-size: 28rpx;
  182. color: #73B8DE;
  183. }
  184. }
  185. .pages {
  186. background-color: #F5F5F5;
  187. // padding-top: 120rpx;
  188. .top_img {
  189. margin-top: 30rpx;
  190. margin-bottom: 50rpx;
  191. height: 184rpx;
  192. }
  193. }
  194. .over_y {
  195. overflow-y: auto;
  196. }
  197. .item_goods {
  198. margin: 0 auto;
  199. width: 713rpx;
  200. margin-top: 38rpx;
  201. margin-bottom: 30rpx;
  202. background-color: #FFF;
  203. border-radius: 34rpx;
  204. box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.16);
  205. display: flex;
  206. flex-direction: column;
  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>