index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view style="padding: 24rpx 20rpx;">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  4. <view class="storebox" v-for="(item,index) in dataList" :key="index">
  5. <image class="logo" :src="item.store.logoUrl" mode="aspectFill"></image>
  6. <view class="storebox-r">
  7. <view class="x-bc" style="flex: 1;">
  8. <view class="" @click="goStoreDetail">
  9. <view class="storename">{{item.store.storeName || ''}}</view>
  10. <!-- <view class="storedesc">24小时营业 销售{{item.store.salesCount|| 0}}</view> -->
  11. </view>
  12. <view class="storebox-btn" @click="navTo(item)">进店</u-icon></view>
  13. </view>
  14. <view class="storebox-desc">
  15. <view>2类器械生产备案:{{item.medicalDevice2Code|| '--'}}</view>
  16. <view>药品经营许可证:{{item.drugCode|| '--'}}</view>
  17. </view>
  18. <!-- <scroll-view :scroll-x="true" class="scrollView">
  19. <view class="scrollItem" v-for="(it,i) in item.recommendProductList" :key="i" @click="showDetail(it)">
  20. <image :src="it.image" mode="aspectFill"></image>
  21. <view style="padding: 8rpx;">
  22. <view class="ellipsis" style="white-space: normal;">{{ it.productName || '' }}</view>
  23. <view class="price-box">
  24. <text class="price-box-unit">¥</text>
  25. <text class="price-box-integer">{{splitPrice(it.price || 0).intPart}}</text>
  26. <text class="price-box-decimal">.{{splitPrice(it.price || 0).decPart}}</text>
  27. </view>
  28. </view>
  29. </view>
  30. </scroll-view> -->
  31. </view>
  32. </view>
  33. </mescroll-body>
  34. </view>
  35. </template>
  36. <script>
  37. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  38. import {recommendList} from "@/api/index.js"
  39. export default {
  40. mixins: [MescrollMixin],
  41. data() {
  42. return {
  43. storeId:'',
  44. list:[],
  45. storeInfo: {},
  46. item: {},
  47. mescroll:null,
  48. downOption: { //下拉刷新
  49. use:true,
  50. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  51. },
  52. upOption: {
  53. onScroll:false,
  54. use: true, // 是否启用上拉加载; 默认true
  55. page: {
  56. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  57. size: 10 // 每页数据的数量,默认10
  58. },
  59. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  60. textNoMore:"已经到底了",
  61. empty: {
  62. icon:'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/empty_icon.png',
  63. tip: '暂无数据'
  64. }
  65. },
  66. dataList: []
  67. }
  68. },
  69. onLoad() {
  70. },
  71. methods: {
  72. // 查看详情
  73. showDetail(item) {
  74. uni.navigateTo({
  75. url: '/pages_shopping/productDetails?productId='+item.productId + `${item.storeId ? '&storeId='+item.storeId : ''}`
  76. })
  77. },
  78. splitPrice(num) {
  79. const [intPart = '0', decPart = '00'] = String(num ||0).split('.');
  80. return { intPart, decPart: decPart.padEnd(2, '0').slice(0, 2) };
  81. },
  82. navTo(item) {
  83. uni.navigateTo({
  84. url: '/pages_store/storeIndex?storeId='+item.store.storeId
  85. })
  86. },
  87. mescrollInit(mescroll) {
  88. this.mescroll = mescroll;
  89. },
  90. /*下拉刷新的回调 */
  91. downCallback(mescroll) {
  92. mescroll.resetUpScroll()
  93. },
  94. upCallback(page) {
  95. //联网加载数据
  96. var that = this;
  97. var data = {
  98. pageNum: page.num,
  99. pageSize: page.size
  100. };
  101. recommendList(data).then(res => {
  102. if(res.code==200){
  103. //设置列表数据
  104. let list = res.rows.map(item=>({
  105. ...item,
  106. recommendProductList: item.recommendProductList&&item.recommendProductList.length > 0 ?item.recommendProductList.splice(0,5):[]
  107. }));
  108. if (page.num == 1) {
  109. that.dataList = list
  110. } else {
  111. that.dataList = that.dataList.concat(list);
  112. }
  113. that.mescroll.endBySize(res.rows.length, res.total);
  114. }else{
  115. uni.showToast({
  116. icon:'none',
  117. title: "请求失败",
  118. });
  119. that.dataList = null;
  120. that.mescroll.endErr();
  121. }
  122. });
  123. },
  124. }
  125. }
  126. </script>
  127. <style scoped lang="scss">
  128. .scrollView {
  129. white-space: nowrap;
  130. margin-top: 10rpx;
  131. .scrollItem {
  132. display: inline-block;
  133. background-color: #f5f5f5;
  134. border-radius: 10rpx;
  135. overflow: hidden;
  136. width: 170rpx;
  137. font-size: 28rpx;
  138. margin-right: 10rpx;
  139. image {
  140. height: 170rpx;
  141. width: 170rpx;
  142. }
  143. }
  144. }
  145. .price-box {
  146. font-family: Roboto, Roboto;
  147. font-weight: bold;
  148. font-size: 28rpx;
  149. color: #FF5C03;
  150. margin-top: 6rpx;
  151. &-unit {
  152. font-weight: 600;
  153. font-size: 22rpx;
  154. }
  155. &-decimal {
  156. font-weight: 600;
  157. font-size: 22rpx;
  158. }
  159. &-text {
  160. font-family: PingFang SC, PingFang SC;
  161. font-weight: 500;
  162. font-size: 22rpx;
  163. }
  164. }
  165. .storebox {
  166. background-color: #fff;
  167. padding: 20rpx;
  168. font-family: PingFang SC;
  169. color: #333333;
  170. border-radius: 16rpx 16rpx 16rpx 16rpx;
  171. overflow: hidden;
  172. display: flex;
  173. align-items: flex-start;
  174. margin-bottom: 24rpx;
  175. &-desc {
  176. font-size: 28rpx;
  177. color: #999;
  178. }
  179. .logo {
  180. flex-shrink: 0;
  181. width: 140rpx;
  182. height: 140rpx;
  183. background: #fff;
  184. border-radius: 16rpx 16rpx 16rpx 16rpx;
  185. border: 1rpx solid #eee;
  186. margin-right: 16rpx;
  187. box-sizing: border-box;
  188. }
  189. .storename {
  190. font-weight: bold;
  191. font-size: 32rpx;
  192. }
  193. .storedesc {
  194. margin-top: 12rpx;
  195. font-weight: 400;
  196. font-size: 22rpx;
  197. }
  198. .storebox-r {
  199. flex: 1;
  200. overflow: hidden;
  201. }
  202. .storebox-btn {
  203. flex-shrink: 0;
  204. padding: 10rpx 24rpx;
  205. font-size: 28rpx;
  206. border-radius: 28rpx 28rpx 28rpx 28rpx;
  207. border: 2rpx solid #FF5C03;
  208. font-weight: 500;
  209. font-size: 24rpx;
  210. color: #FF5C03;
  211. }
  212. }
  213. </style>