index.vue 7.4 KB

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