index.vue 5.9 KB

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