青蛙卖大米小程序2024-11-24
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

626 lines
12 KiB

5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 months ago
3 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
  1. <template>
  2. <view class="page">
  3. <navbar bgColor="#88D259" />
  4. <view class="bg-color"></view>
  5. <view class="page-title">
  6. <!-- {{ configList.index_title }} -->
  7. <!-- <image src="/static/image/home/logo.png"
  8. style="width: 240rpx;"
  9. mode="widthFix"></image> -->
  10. <image :src="configList.index_img"
  11. style="width: 240rpx;height: 100rpx;"
  12. mode="widthFix"></image>
  13. </view>
  14. <view class="search">
  15. <uv-search
  16. placeholder="搜你喜欢的产品"
  17. bgColor="#fff"
  18. @custom="search"
  19. @search="search"
  20. v-model="keyword"></uv-search>
  21. </view>
  22. <view class="swipe">
  23. <uv-swiper
  24. :list="bannerList"
  25. indicator height="320rpx"
  26. keyName="image"></uv-swiper>
  27. </view>
  28. <view class="notice">
  29. <uv-notice-bar fontSize="32rpx"
  30. @click="$utils.navigateTo('/pages_order/home/notice')"
  31. :text="notice"></uv-notice-bar>
  32. </view>
  33. <view class="menu">
  34. <uv-grid :border="false" :col="4" >
  35. <uv-grid-item v-for="(item,index) in baseList" :key="index"
  36. @click="toUrl(item.url)">
  37. <image :src="item.image" mode="aspectFill"></image>
  38. <text class="menu-text">{{item.title}}</text>
  39. </uv-grid-item>
  40. </uv-grid>
  41. </view>
  42. <view class="map"
  43. v-if="configList.qd_image">
  44. <image :src="configList.qd_image" mode="widthFix" />
  45. </view>
  46. <view class="commodity"
  47. @click="$utils.navigateTo('/pages/index/category')">
  48. <view class="box">
  49. <view class="top">
  50. <view class="top-text">
  51. <view>Experience the product</view>
  52. <view>体验产品 ___ _</view>
  53. </view>
  54. </view>
  55. <view class="centre">
  56. <view class="boxs"
  57. :key="index"
  58. @click.stop="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id)"
  59. v-for="(item, index) in riceProductList">
  60. <view class="box-text">
  61. <view>{{ item.title }}</view>
  62. <view>{{ item.sku }}</view>
  63. <text class="text1">{{ item.price }}</text>
  64. <text class="text2">原价{{ item.oldPrice }}</text>
  65. </view>
  66. <view class="box-img">
  67. <image :src="item.image &&
  68. item.image.split(',')[0]" mode="aspectFill"></image>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="commodity"
  75. @click="$utils.navigateTo('/pages/index/category')">
  76. <view class="box">
  77. <view class="top">
  78. <view class="top-text">
  79. <view>Conventional product</view>
  80. <view>常规产品 ___ _</view>
  81. </view>
  82. </view>
  83. <view class="centre">
  84. <view class="boxs"
  85. :key="index"
  86. @click.stop="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id)"
  87. v-for="(item, index) in commonProductList">
  88. <view class="box-text">
  89. <view>{{ item.title }}</view>
  90. <view>{{ item.sku }}</view>
  91. <view class="text3">会员价 <text>{{ item.vipPrice }}</text> </view>
  92. <view class="text4">零售价{{ item.price }}</view>
  93. </view>
  94. <view class="box-img">
  95. <image :src="item.image &&
  96. item.image.split(',')[0]" mode="aspectFill"></image>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <view class="commodity">
  103. <view class="box">
  104. <view class="top">
  105. <view class="top-text">
  106. <view>News trends</view>
  107. <view>新闻动态 ___ _</view>
  108. </view>
  109. <view class="top1"
  110. @click="$utils.navigateTo('/pages_order/home/journalism')"
  111. >
  112. 更多
  113. </view>
  114. </view>
  115. <view class="centre">
  116. <view class="boxs"
  117. :key="index"
  118. @click="$utils.navigateTo('/pages_order/home/newsDetail?id=' + item.id)"
  119. v-for="(item, index) in newList"
  120. >
  121. <view class="images">
  122. <image :src="item.image &&
  123. item.image.split(',')[0]" mode="aspectFill"></image>
  124. </view>
  125. <view class="box-fone">
  126. <view>{{ item.title }}</view>
  127. <view>{{ item.title }}</view>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <!-- <view class="qr">
  134. <view class="scan">扫码关注公众号</view>
  135. <view class="qr-scan">
  136. <image :src="configList.down_image" mode="aspectFill"></image>
  137. </view>
  138. <view class="qr-bottom">
  139. <view
  140. @click="saveImage(configList.down_image)"
  141. >保存公众号二维码图片</view>
  142. </view>
  143. </view> -->
  144. <PrivacyAgreementPoup />
  145. <customerServicePopup ref="customerServicePopup"/>
  146. <tabber select="home" />
  147. </view>
  148. </template>
  149. <script>
  150. import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
  151. import Position from '@/utils/position.js'
  152. import tabber from '@/components/base/tabbar.vue'
  153. import { mapState } from 'vuex'
  154. import customerServicePopup from '@/components/config/customerServicePopup.vue'
  155. export default {
  156. components: {
  157. tabber,
  158. PrivacyAgreementPoup,
  159. customerServicePopup,
  160. },
  161. data() {
  162. return {
  163. notice: '',
  164. bannerList: [],
  165. baseList: [
  166. // {
  167. // image: '/static/image/home/0.png',
  168. // title: '关于我们',
  169. // path: '/pages_order/home/introduce',
  170. // },
  171. // {
  172. // image: '/static/image/home/1.png',
  173. // title: '产品介绍',
  174. // },
  175. // {
  176. // image: '/static/image/home/2.png',
  177. // title: '促销活动',
  178. // },
  179. // {
  180. // image: '/static/image/home/3.png',
  181. // title: '商城',
  182. // },
  183. // {
  184. // image: '/static/image/home/4.png',
  185. // title: '邀请好友',
  186. // },
  187. // {
  188. // image: '/static/image/home/5.png',
  189. // title: '新闻中心',
  190. // path: '/pages_order/home/journalism',
  191. // },
  192. // {
  193. // image: '/static/image/home/6.png',
  194. // title: '企业合作',
  195. // },
  196. // {
  197. // image: '/static/image/home/7.png',
  198. // title: '联系我们',
  199. // },
  200. ],
  201. productList: [],
  202. keyword: '',
  203. commonProductList : [],//常规产品
  204. riceProductList : [],//体验产品
  205. newList : [],//新闻列表
  206. }
  207. },
  208. computed: {},
  209. onLoad(query) {
  210. if (query.shareId) {
  211. uni.setStorageSync('shareId', query.shareId)
  212. }
  213. },
  214. onShow() {
  215. this.getBanner()
  216. this.getRiceNoticeList()
  217. this.getRiceCommonProductList()
  218. this.getRiceProductList()
  219. this.getRiceNewsList()
  220. this.getRiceIconList()
  221. },
  222. onPullDownRefresh() {
  223. this.getBanner()
  224. this.getRiceNoticeList()
  225. this.getRiceCommonProductList()
  226. this.getRiceProductList()
  227. this.getRiceNewsList()
  228. },
  229. methods: {
  230. // 搜素
  231. search(){
  232. uni.navigateTo({
  233. url: '/pages/index/category?search=' + this.keyword
  234. })
  235. this.keyword = ''
  236. },
  237. // 获取轮播图
  238. getBanner(){
  239. this.$api('getRiceBanner', res => {
  240. if(res.code == 200){
  241. this.bannerList = res.result
  242. }
  243. })
  244. },
  245. // 获取公告
  246. getRiceNoticeList(){
  247. this.$api('getRiceNoticeList', res => {
  248. if(res.code == 200){
  249. this.notice = res.result.title
  250. }
  251. })
  252. },
  253. // 获取常规产品
  254. getRiceCommonProductList(){
  255. this.$api('getRiceCommonProductList', res => {
  256. uni.stopPullDownRefresh()
  257. if(res.code == 200){
  258. this.commonProductList = res.result
  259. }
  260. })
  261. },
  262. // 获取首页体验产品
  263. getRiceProductList(){
  264. this.$api('getRiceProductList', res => {
  265. if(res.code == 200){
  266. this.riceProductList = res.result
  267. }
  268. })
  269. },
  270. // 获取首页新闻列表
  271. getRiceNewsList(){
  272. this.$api('getRiceNewsList', res => {
  273. if(res.code == 200){
  274. this.newList = res.result.records
  275. }
  276. })
  277. },
  278. // 获取首页跳转图标
  279. getRiceIconList(){
  280. this.$api('getRiceIconList', res => {
  281. if(res.code == 200){
  282. this.baseList = res.result
  283. }
  284. })
  285. },
  286. toUrl(url){
  287. if(!url){
  288. uni.showToast({
  289. title: '功能暂未开放'
  290. })
  291. return
  292. }
  293. if(url == '::phone'){
  294. this.$refs.customerServicePopup.open()
  295. return
  296. }
  297. uni.navigateTo({
  298. url
  299. })
  300. },
  301. saveImage(image){
  302. /* 获取图片的信息 */
  303. uni.getImageInfo({
  304. src: image,
  305. success: function(image) {
  306. /* 保存图片到手机相册 */
  307. uni.saveImageToPhotosAlbum({
  308. filePath: image.path,
  309. success: function() {
  310. uni.showModal({
  311. title: '保存成功',
  312. content: '图片已成功保存到相册',
  313. showCancel: false
  314. });
  315. },
  316. complete(res) {
  317. console.log(res);
  318. }
  319. });
  320. }
  321. });
  322. },
  323. },
  324. }
  325. </script>
  326. <style scoped lang="scss">
  327. .page {
  328. position: relative;
  329. .bg-color {
  330. width: 100%;
  331. position: absolute;
  332. top: 0;
  333. left: 0;
  334. height: 550rpx;
  335. background: linear-gradient(to bottom, #88D259, #88D259, #fff);
  336. }
  337. .page-title {
  338. position: relative;
  339. margin-left: 30rpx;
  340. // margin-bottom: 30rpx;
  341. font-size: 34rpx;
  342. font-weight: 900;
  343. }
  344. .search {
  345. position: relative;
  346. background: #FFFFFF;
  347. margin: 20rpx;
  348. border-radius: 41rpx;
  349. padding: 10rpx 20rpx;
  350. display: flex;
  351. align-items: center;
  352. /deep/ .uv-search__action {
  353. background-color: $uni-color;
  354. color: #FFFFFF;
  355. padding: 10rpx 20rpx;
  356. border-radius: 30rpx;
  357. }
  358. }
  359. .swipe {
  360. position: relative;
  361. overflow: hidden;
  362. border-radius: 20rpx;
  363. margin: 20rpx;
  364. }
  365. .menu {
  366. margin: 20rpx;
  367. border-radius: 20rpx;
  368. padding: 20rpx;
  369. background-color: #fff;
  370. box-shadow: 0 0 10rpx 10rpx #00000009;
  371. image {
  372. width: 80rpx;
  373. height: 80rpx;
  374. margin-top: 10rpx;
  375. }
  376. .menu-text {
  377. font-size: 28rpx;
  378. margin-bottom: 10rpx;
  379. margin-top: 10rpx;
  380. }
  381. }
  382. .notice {
  383. margin: 0 20rpx;
  384. /deep/ .uv-notice-bar {
  385. background: linear-gradient(to right, #f9edc9, #dfedd6);
  386. border-radius: 16rpx;
  387. }
  388. /deep/ .uv-notice {
  389. padding: 14rpx 0;
  390. }
  391. /deep/ .uv-icon__icon {
  392. font-size: 36rpx !important;
  393. color: #000 !important;
  394. }
  395. }
  396. .map {
  397. margin: 20rpx;
  398. border-radius: 16rpx;
  399. image {
  400. width: 100%;
  401. }
  402. }
  403. .commodity {
  404. display: flex;
  405. justify-content: center;
  406. align-items: center;
  407. margin: 20rpx;
  408. border-radius: 16rpx;
  409. background-color: #fff;
  410. .box {
  411. width: 100%;
  412. margin: 20rpx;
  413. .top {
  414. display: flex;
  415. border-left: 6rpx solid #A3D250;
  416. align-items: center;
  417. justify-content: space-between;
  418. .top-text {
  419. margin-left: 20rpx;
  420. view:nth-child(1) {
  421. font-size: 24rpx;
  422. color: #474747;
  423. }
  424. view:nth-child(2) {
  425. font-size: 32rpx;
  426. color: #A3D250;
  427. font-weight: 600;
  428. }
  429. }
  430. .top1 {
  431. font-size: 26rpx;
  432. color: #fff;
  433. padding: 10rpx 30rpx;
  434. background-color: #F6CD59;
  435. border-radius: 30rpx;
  436. }
  437. }
  438. }
  439. .centre {
  440. margin: 40rpx 20rpx;
  441. display: flex;
  442. flex-direction: column;
  443. align-items: center;
  444. justify-content: center;
  445. .boxs {
  446. display: flex;
  447. width: 100%;
  448. align-items: center;
  449. justify-content: center;
  450. margin-top: 20rpx;
  451. background-color: #f9f9f9;
  452. border-radius: 20rpx;
  453. padding: 20rpx;
  454. .images {
  455. width: 180rpx;
  456. height: 140rpx;
  457. flex-shrink: 0;
  458. border-radius: 8rpx;
  459. overflow: hidden;
  460. image {
  461. width: 100%;
  462. height: 100%;
  463. }
  464. }
  465. .box-fone {
  466. margin-left: 20rpx;
  467. flex: 1;
  468. view:nth-child(1) {
  469. font-size: 36rpx;
  470. color: #474747;
  471. }
  472. view:nth-child(2) {
  473. margin-top: 10rpx;
  474. font-size: 28rpx;
  475. color: #A2A2A2;
  476. }
  477. }
  478. .box-text,
  479. .box-img {
  480. flex: 1;
  481. }
  482. .box-img{
  483. height: 220rpx;
  484. image{
  485. width: 100%;
  486. height: 100%;
  487. }
  488. }
  489. .box-text {
  490. view:nth-child(1) {
  491. font-size: 32rpx;
  492. font-weight: 500;
  493. margin-top: 30rpx;
  494. }
  495. view:nth-child(2) {
  496. font-size: 28rpx;
  497. color: #CCCCCC;
  498. margin-bottom: 30rpx;
  499. }
  500. .text1 {
  501. color: #f40;
  502. font-size: 58rpx;
  503. }
  504. .text2 {
  505. font-size: 28rpx;
  506. color: #999;
  507. }
  508. .text3 {
  509. color: #f40;
  510. font-size: 28rpx;
  511. text{
  512. font-size: 30rpx;
  513. font-weight: 900;
  514. }
  515. }
  516. .text4 {
  517. font-size: 26rpx;
  518. color: #999;
  519. }
  520. }
  521. .box-img {
  522. image {
  523. height: 100%;
  524. width: 100%;
  525. }
  526. }
  527. }
  528. }
  529. }
  530. .qr {
  531. margin-top: 40rpx;
  532. .scan {
  533. text-align: center;
  534. font-size: 28rpx;
  535. color: #A2A2A2;
  536. }
  537. .qr-scan {
  538. margin: 20rpx auto;
  539. width: 400rpx;
  540. height: 400rpx;
  541. image {
  542. height: 100%;
  543. width: 100%;
  544. }
  545. }
  546. .qr-bottom {
  547. display: flex;
  548. font-size: 28rpx;
  549. color: #A2A2A2;
  550. justify-content: space-around;
  551. padding-bottom: 20rpx;
  552. view {
  553. border: 2rpx solid #A2A2A2;
  554. padding: 20rpx;
  555. border-radius: 45rpx;
  556. }
  557. }
  558. }
  559. }
  560. </style>