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

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