index.vue 9.7 KB

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