青蛙卖大米小程序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.

596 lines
12 KiB

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