store_options.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view>
  3. <!--components/store_options/store_options.wxml-->
  4. <template name="store_options">
  5. <view :class="'top' + (skinNotColor?' not-color' : '')">
  6. <block v-if="!skinNotColor">
  7. <image :src="about.CONFIG_MERCHANT_BG" class="top-bg" v-if="about.CONFIG_MERCHANT_BG"></image>
  8. <image :src="picUrlss+'top_bg.png'" class="top-bg" v-else></image>
  9. </block>
  10. <view class="topcon ddflex pdlr20" v-if="storeTemplate&&storeTemplate.state==0">
  11. <image :src="merchant.logo ? merchant.logo : about.CONFIG_INDEX_LOGO" mode="aspectFit" class="logo r50 bgfff mr20"></image>
  12. <view class="area fflex" @tap="cloud=='default'?'':merchantFun()">
  13. <view class="areas f28 ddflex">
  14. {{merchant.title ? merchant.title : '请选择门店'}}
  15. <view class="change ddflex" @tap="merchantFun()" v-if="cloud!='default'&&about.User_Limit_Store!=1&&about.Many_Store!=0">切换<image src="../../static/pages/images/change.png"></image></view>
  16. <!-- <image src="/static/pages/images/sanjiao.png" v-if="cloud!='default'&&about.User_Limit_Store!=1&&about.Many_Store!=0"></image> -->
  17. </view>
  18. <view class="cont dflex" v-if="cloud=='default'||about.User_Limit_Store==1">
  19. <view v-for="(item, index) in guarantee" :key="index" class="dflex li" v-if="index<3">
  20. <image src="/static/pages/images/guarantee.png"></image>{{item}}
  21. </view>
  22. </view>
  23. <view class="recent dflex" v-else>
  24. <text class="scolor bgfff">最近门店</text>
  25. <block v-if="merchant.range!=50000">
  26. {{merchant.range ? merchant.mDistance < 1000 ? merchant.mDistance+'m' : merchant.range+'km' : ''}}</block>
  27. </view>
  28. </view>
  29. <button open-type="share" class="m-share"><image src="../../static/pages/images/share1.png"></image>分享</button>
  30. <!-- <view class="renqi">{{merchant.person}}<text>人气</text></view> -->
  31. </view>
  32. <view class="top-nav" v-if="categoryList.length>0 && typeDistrictTemplate && typeDistrictTemplate.state==0">
  33. <scroll-view scroll-x="true">
  34. <block v-for="(item, index) in categoryList" :key="index">
  35. <navigator :url="'/product/list/list?id=' + item.id + '&title=' + item.title + '' + web" hover-class="none" class="li">{{item.title}}</navigator>
  36. </block>
  37. </scroll-view>
  38. <navigator url="/pages/sort/sort" open-type="switchTab" hover-class="none" class="column dflex"><image src="../../static/pages/images/nav.png"></image></navigator>
  39. </view>
  40. <view class="box1 pdlr30 ddflex">
  41. <view v-if="sousuoTemplate&&sousuoTemplate.state==0" class="search ddflex fflex">
  42. <view class="dflex flex" @tap="search">
  43. <image src="/static/pages/images/ssico.png" class="ssico"></image>
  44. <view class="flex">搜索你想要的商品</view>
  45. </view>
  46. <!-- #ifndef H5 -->
  47. <!-- <image src="/static/pages/images/sao.png" @tap="saoma" class="sao"></image> -->
  48. <!-- #endif -->
  49. </view>
  50. <button open-type="contact" class="idx-top-contact"><image :src="picUrlss+'meizhihua/idx_top_contact.png'"></image></button>
  51. </view>
  52. </view>
  53. <!-- <view class="box1 bgfff pdlr20"
  54. style="margin-top: {{merchant.id&&storeTemplate&&storeTemplate.state==0? '-52rpx' : 0}}">
  55. <view wx:if="{{sousuoTemplate&&sousuoTemplate.state==0}}" class="search dflex">
  56. <view class="dflex flex" bindtap="search">
  57. <image src="/pages/images/ssico.png" class="ssico"></image>
  58. <view class="flex">搜索你想要的商品</view>
  59. </view>
  60. <image src="/pages/images/sao.png" bindtap="saoma" class="sao"></image>
  61. </view>
  62. </view> -->
  63. <!-- <view class="box1 bgfff pdlr20" style="{{souShow?'margin-top: -28px':''}}" wx:if="{{souShow}}">
  64. </view> -->
  65. </template>
  66. </view>
  67. </template>
  68. <script>
  69. // components/store_options/store_options.js
  70. // 门店选择
  71. const app = getApp();
  72. const req = require("../../utils/request.js");
  73. const api = require("../../utils/api.js");
  74. const route = require("../../utils/route.js");
  75. export default {
  76. data() {
  77. return {
  78. picUrlss: req.public.picUrls,
  79. skinNotColor: req.public.skinNotColor,
  80. categoryList: []
  81. };
  82. },
  83. components: {},
  84. props: {
  85. storeTemplate: Object, //门店配置
  86. merchant: Object, //门店
  87. about: Object, //参数配置
  88. // timelyTemplate: Object,
  89. guarantee: Array, //配置商城服务保障
  90. sousuoTemplate: Object, //搜索配置
  91. cloud:String, //荣康的是否默认门店
  92. web:String, //路由跳转
  93. url:String ,//路由跳转
  94. typeDistrictTemplate: Object //分类导航
  95. },
  96. watch: {
  97. },
  98. beforeMount() {},
  99. mounted() { // this.init()
  100. this.getCategory();
  101. // console.log(this.merchant,this.cloud,this.guarantee,this.storeTemplate,this.sousuoTemplate,this.timelyTemplate)
  102. },
  103. onPageShow() {},
  104. methods: {
  105. search() {
  106. // app.openPage('pages/search/search')
  107. app.globalData.openPage('pages/search/search'+this.url)
  108. },
  109. merchantFun() {
  110. if(this.about.User_Limit_Store==1||this.about.Many_Store==0){
  111. }else{
  112. app.globalData.openPage('merchant/nearby/nearby')
  113. }
  114. },
  115. saoma() {
  116. var _this = this;
  117. // #ifndef H5
  118. // 允许从相机和相册扫码
  119. uni.scanCode({
  120. success: (res) => {
  121. uni.navigateTo({
  122. url: '/' + res.path,
  123. })
  124. // this.scene = '1290926887903780865';
  125. this.loadCodeParams();
  126. }
  127. })
  128. // #endif
  129. },
  130. loadCodeParams() {
  131. let _ts = this;
  132. return new Promise((resolve, reject) => {
  133. if (!_ts.scene) {
  134. resolve();
  135. return false;
  136. }
  137. req.getRequest('/api/code/params', {
  138. scene: _ts.scene
  139. }, data => {
  140. req.setStorage('pidCode', data.userId);
  141. resolve();
  142. });
  143. });
  144. },
  145. getCategory() {
  146. //产品分类
  147. let that = this;
  148. route.getCategory({
  149. pid: 0
  150. }, res => {
  151. this.categoryList = res;
  152. });
  153. },
  154. }
  155. };
  156. </script>
  157. <style>
  158. @import "./store_options.css";
  159. </style>