index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <view>
  3. <!-- 选择门店 -->
  4. <view class="product-window on" :class="[module?'ons':'']">
  5. <view class="store-box">
  6. <view class="store-title">配送</view>
  7. <view class="iconfont icon-guanbi5" @click="module=false" />
  8. <view class="cart acea-row row-middle">
  9. <view class="mode acea-row row-center-wrapper" v-if="isDisplay.includes('1')"
  10. @click="storeNewInfofN(1)" :class="flag==1?'select':''">商城配送
  11. </view>
  12. <view class="mode acea-row row-center-wrapper" v-if="isDisplay.includes('2') && storeSelfMention"
  13. @click="storeNewInfofN(2)" :class="flag==2?'select':''">门店自提
  14. </view>
  15. <view class="mode acea-row row-center-wrapper" v-if="isDisplay.includes('3')"
  16. @click="storeNewInfofN(3)" :class="flag==3?'select':''">门店配送
  17. </view>
  18. </view>
  19. <view class="list-box" v-if="flag!=1">
  20. <view class="list acea-row row-between-wrapper" v-for="(item,index) in storeList" :key="index" @click="activeFn(index,item)"
  21. :class="{active:sortIndex===index}">
  22. <text class="iconfont icon-xuanzhong6" v-if="sortIndex===index"></text>
  23. <view class="left">
  24. <view class="name line1">{{item.name}}</view>
  25. <view class="adress acea-row">
  26. <text class="iconfont icon-dingwei2" />
  27. <view class="detail">{{item.detailed_address}}</view>
  28. </view>
  29. <view class="adress">
  30. <text class="iconfont icon-yingyeshijian2" />
  31. 营业时间:{{item.day_time}}
  32. </view>
  33. </view>
  34. <view class="right">
  35. <view class="font-num" @click.stop="goStore(item)">进店选购</view>
  36. <view class="km">距离{{item.range}}km</view>
  37. <view class="icon acea-row row-center">
  38. <view class="iconfont icon-dianhua" @click.stop="call(item.phone)"></view>
  39. <view class="iconfont icon-dingwei2" @click.stop="showMaoLocation(item)"></view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="btn" @click="define">确认</view>
  45. </view>
  46. </view>
  47. <view class="mask" @touchmove.prevent @click="module=false" v-if="module"></view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. props: {
  53. isDisplay: {
  54. type: Array,
  55. default:()=>[]
  56. },
  57. storeList: {
  58. type: Array,
  59. default:()=>[]
  60. },
  61. storeSelfMention: {
  62. type: Boolean,
  63. default: false
  64. }
  65. },
  66. data() {
  67. return {
  68. flag: 1,
  69. sortIndex: 0,
  70. module: false,
  71. storeItem: {}
  72. };
  73. },
  74. watch:{
  75. isDisplay(v) {
  76. this.flag = v[0]
  77. if(this.flag == 2 || this.flag == 3){
  78. this.storeNewInfofN(this.flag)
  79. }
  80. },
  81. storeList(v){
  82. this.storeItem = v[0];
  83. }
  84. },
  85. mounted() {},
  86. methods: {
  87. // 跳转门店
  88. goStore(item){
  89. uni.setStorageSync('user_latitude',item.latitude)
  90. uni.setStorageSync('user_longitude',item.longitude)
  91. uni.setStorageSync('store_id',item.id)
  92. uni.switchTab({
  93. url:'/pages/store_cate/store_cate'
  94. })
  95. },
  96. showMaoLocation(e) {
  97. let self = this;
  98. // #ifdef H5
  99. if (self.$wechat.isWeixin()) {
  100. self.$wechat.seeLocation({
  101. latitude: Number(e.latitude),
  102. longitude: Number(e.longitude),
  103. name: e.name,
  104. scale: 13,
  105. address: `${e.address}-${e.detailed_address}`,
  106. }).then(res => {})
  107. } else {
  108. // #endif
  109. uni.openLocation({
  110. latitude: Number(e.latitude),
  111. longitude: Number(e.longitude),
  112. name: e.name,
  113. address: `${e.address}-${e.detailed_address}`,
  114. success: function() {
  115. Number
  116. }
  117. });
  118. // #ifdef H5
  119. }
  120. // #endif
  121. },
  122. call(phone) {
  123. uni.makePhoneCall({
  124. phoneNumber: phone,
  125. });
  126. },
  127. define(){
  128. this.$emit('deliveryFun',this.flag,this.storeItem);
  129. },
  130. // 选择配送方式
  131. storeNewInfofN(index) {
  132. this.flag = index;
  133. this.sortIndex = 0;
  134. if(index != 1){
  135. this.$emit('storeFun',index)
  136. }
  137. },
  138. // 点击高亮
  139. activeFn(index,item) {
  140. this.sortIndex = index
  141. this.storeItem = item
  142. }
  143. }
  144. }
  145. </script>
  146. <style lang="scss">
  147. .select {
  148. color: var(--view-theme) !important;
  149. background: var(--view-minorColorT) !important;
  150. border: 1px solid var(--view-theme) !important;
  151. }
  152. .active {
  153. position: relative;
  154. border: 1px solid var(--view-theme) !important;
  155. .icon-xuanzhong6 {
  156. font-size: 46rpx;
  157. position: absolute;
  158. bottom: -4rpx;
  159. right: -6rpx;
  160. color: var(--view-theme);
  161. }
  162. }
  163. .product-window {
  164. position: fixed;
  165. bottom: 0;
  166. width: 100%;
  167. left: 0;
  168. background-color: #f5f5f5;
  169. z-index: 120;
  170. border-radius: 16rpx 16rpx 0 0;
  171. transform: translate3d(0, 100%, 0);
  172. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  173. padding-bottom: 140rpx;
  174. padding-bottom: calc(140rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  175. padding-bottom: calc(140rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  176. &.on{
  177. background-color: #fff;
  178. }
  179. &.ons{
  180. transform: translate3d(0, 0, 0);
  181. }
  182. }
  183. .product-window .cart {
  184. display: flex;
  185. margin-top: 20rpx;
  186. padding: 0 28rpx 20rpx 28rpx;
  187. }
  188. .product-window .cart .mode {
  189. margin-top: 16rpx;
  190. width: 220rpx;
  191. height: 90rpx;
  192. border-radius: 8rpx;
  193. background: #f5f5f5;
  194. font-size: 26rpx;
  195. font-weight: 400;
  196. color: #333;
  197. margin-right: 16rpx;
  198. border-radius: 1px solid #f5f5f5;
  199. &:nth-of-type(3n){
  200. margin-right: 0;
  201. }
  202. }
  203. .store-title {
  204. font-size: 30rpx;
  205. font-family: PingFangSC-Semibold, PingFang SC;
  206. font-weight: 600;
  207. color: #333333;
  208. text-align: center;
  209. }
  210. .store-header {
  211. display: flex;
  212. font-size: 26rpx;
  213. font-weight: 400;
  214. color: #999999;
  215. .img {
  216. width: 28rpx;
  217. height: 26rpx;
  218. margin-right: 10rpx;
  219. margin-top: 4rpx;
  220. }
  221. .icon-gengduo3 {
  222. margin-top: 10rpx;
  223. margin-left: 4rpx;
  224. font-size: 16rpx;
  225. }
  226. }
  227. .store-box {
  228. height: 900rpx;
  229. position: relative;
  230. padding-top: 30rpx;
  231. .icon-guanbi5 {
  232. position: absolute;
  233. right: 30rpx;
  234. top: 28rpx;
  235. font-size: 38rpx;
  236. color: #888888;
  237. }
  238. .list-box {
  239. height: 700rpx;
  240. overflow-x: hidden;
  241. overflow-y: auto;
  242. background: #f5f5f5;
  243. padding-bottom: 20rpx;
  244. .list {
  245. width: 690rpx;
  246. background: #FFFFFF;
  247. border-radius: 12rpx;
  248. margin: 20rpx auto 0 auto;
  249. border: 1px solid #fff;
  250. padding: 28rpx 0 28rpx 30rpx;
  251. .left {
  252. width: 434rpx;
  253. .name {
  254. font-size: 28rpx;
  255. font-weight: 500;
  256. color: #333333;
  257. }
  258. .adress {
  259. margin-top: 18rpx;
  260. word-wrap: break-word;
  261. font-size: 22rpx;
  262. font-weight: 400;
  263. color: #888888;
  264. .detail{
  265. width: 396rpx;
  266. }
  267. .icon-dingwei2 {
  268. margin-right: 8rpx;
  269. font-size: 18rpx;
  270. color: #ccc;
  271. margin-top:4rpx;
  272. }
  273. .icon-yingyeshijian2 {
  274. margin-right: 8rpx;
  275. font-size: 18rpx;
  276. color: #ccc;
  277. }
  278. }
  279. }
  280. .right{
  281. text-align: center;
  282. width: 214rpx;
  283. height: 136rpx;
  284. font-size: 22rpx;
  285. font-weight: 400;
  286. .km{
  287. color: #999999;
  288. font-size: 20rpx;
  289. margin-top: 10rpx;
  290. }
  291. .icon{
  292. margin-top: 16rpx;
  293. .iconfont{
  294. width: 40rpx;
  295. height: 40rpx;
  296. background: var(--view-minorColorT);
  297. border-radius: 50%;
  298. color: var(--view-theme);
  299. font-size: 22rpx;
  300. text-align: center;
  301. line-height: 40rpx;
  302. &.icon-dingwei2{
  303. margin-left: 24rpx;
  304. }
  305. }
  306. }
  307. }
  308. }
  309. }
  310. }
  311. .mask {
  312. z-index: 0;
  313. }
  314. .btn {
  315. position: fixed;
  316. bottom: 20rpx;
  317. left: 30rpx;
  318. width: 690rpx;
  319. height: 86rpx;
  320. background: var(--view-theme);
  321. border-radius: 43rpx;
  322. text-align: center;
  323. line-height: 86rpx;
  324. font-size: 30rpx;
  325. font-weight: 500;
  326. color: #FFFFFF;
  327. }
  328. </style>