index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <view>
  3. <!-- 选择门店 -->
  4. <view class="product-window on" :class="[module?'ons':'']">
  5. <view class="store-box">
  6. <view class="store-title" :class="isDisplay.length>1?'on':''">配送</view>
  7. <view class="iconfont icon-guanbi5" @click="module=false" />
  8. <view class="cart acea-row row-middle" v-if="isDisplay.length>1">
  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 | Number,
  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. padding-bottom: 15px;
  210. }
  211. .store-header {
  212. display: flex;
  213. font-size: 26rpx;
  214. font-weight: 400;
  215. color: #999999;
  216. .img {
  217. width: 28rpx;
  218. height: 26rpx;
  219. margin-right: 10rpx;
  220. margin-top: 4rpx;
  221. }
  222. .icon-gengduo3 {
  223. margin-top: 10rpx;
  224. margin-left: 4rpx;
  225. font-size: 16rpx;
  226. }
  227. }
  228. .store-box {
  229. height: 900rpx;
  230. position: relative;
  231. padding-top: 30rpx;
  232. .icon-guanbi5 {
  233. position: absolute;
  234. right: 30rpx;
  235. top: 28rpx;
  236. font-size: 38rpx;
  237. color: #888888;
  238. }
  239. .list-box {
  240. height: 700rpx;
  241. overflow-x: hidden;
  242. overflow-y: auto;
  243. background: #f5f5f5;
  244. padding-bottom: 20rpx;
  245. .list {
  246. width: 690rpx;
  247. background: #FFFFFF;
  248. border-radius: 12rpx;
  249. margin: 20rpx auto 0 auto;
  250. border: 1px solid #fff;
  251. padding: 28rpx 0 28rpx 30rpx;
  252. .left {
  253. width: 434rpx;
  254. .name {
  255. font-size: 28rpx;
  256. font-weight: 500;
  257. color: #333333;
  258. }
  259. .adress {
  260. margin-top: 18rpx;
  261. word-wrap: break-word;
  262. font-size: 22rpx;
  263. font-weight: 400;
  264. color: #888888;
  265. .detail{
  266. width: 396rpx;
  267. }
  268. .icon-dingwei2 {
  269. margin-right: 8rpx;
  270. font-size: 18rpx;
  271. color: #ccc;
  272. margin-top:4rpx;
  273. }
  274. .icon-yingyeshijian2 {
  275. margin-right: 8rpx;
  276. font-size: 18rpx;
  277. color: #ccc;
  278. }
  279. }
  280. }
  281. .right{
  282. text-align: center;
  283. width: 214rpx;
  284. height: 136rpx;
  285. font-size: 22rpx;
  286. font-weight: 400;
  287. .km{
  288. color: #999999;
  289. font-size: 20rpx;
  290. margin-top: 10rpx;
  291. }
  292. .icon{
  293. margin-top: 16rpx;
  294. .iconfont{
  295. width: 40rpx;
  296. height: 40rpx;
  297. background: var(--view-minorColorT);
  298. border-radius: 50%;
  299. color: var(--view-theme);
  300. font-size: 22rpx;
  301. text-align: center;
  302. line-height: 40rpx;
  303. &.icon-dingwei2{
  304. margin-left: 24rpx;
  305. }
  306. }
  307. }
  308. }
  309. }
  310. }
  311. }
  312. .mask {
  313. z-index: 0;
  314. }
  315. .btn {
  316. position: fixed;
  317. bottom: 20rpx;
  318. left: 30rpx;
  319. width: 690rpx;
  320. height: 86rpx;
  321. background: var(--view-theme);
  322. border-radius: 43rpx;
  323. text-align: center;
  324. line-height: 86rpx;
  325. font-size: 30rpx;
  326. font-weight: 500;
  327. color: #FFFFFF;
  328. }
  329. </style>