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

589 lines
12 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 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. onShow() {
  202. this.getBanner()
  203. this.getRiceNoticeList()
  204. this.getRiceCommonProductList()
  205. this.getRiceProductList()
  206. this.getRiceNewsList()
  207. this.getRiceIconList()
  208. },
  209. onPullDownRefresh() {
  210. this.getBanner()
  211. this.getRiceNoticeList()
  212. this.getRiceCommonProductList()
  213. this.getRiceProductList()
  214. this.getRiceNewsList()
  215. },
  216. methods: {
  217. // 获取轮播图
  218. getBanner(){
  219. this.$api('getRiceBanner', res => {
  220. if(res.code == 200){
  221. this.bannerList = res.result
  222. }
  223. })
  224. },
  225. // 获取公告
  226. getRiceNoticeList(){
  227. this.$api('getRiceNoticeList', res => {
  228. if(res.code == 200){
  229. this.notice = res.result.title
  230. }
  231. })
  232. },
  233. // 获取常规产品
  234. getRiceCommonProductList(){
  235. this.$api('getRiceCommonProductList', res => {
  236. uni.stopPullDownRefresh()
  237. if(res.code == 200){
  238. this.commonProductList = res.result
  239. }
  240. })
  241. },
  242. // 获取首页体验产品
  243. getRiceProductList(){
  244. this.$api('getRiceProductList', res => {
  245. if(res.code == 200){
  246. this.riceProductList = res.result
  247. }
  248. })
  249. },
  250. // 获取首页新闻列表
  251. getRiceNewsList(){
  252. this.$api('getRiceNewsList', res => {
  253. if(res.code == 200){
  254. this.newList = res.result.records
  255. }
  256. })
  257. },
  258. // 获取首页跳转图标
  259. getRiceIconList(){
  260. this.$api('getRiceIconList', res => {
  261. if(res.code == 200){
  262. this.baseList = res.result
  263. }
  264. })
  265. },
  266. toUrl(url){
  267. if(!url){
  268. uni.showToast({
  269. title: '功能暂未开放'
  270. })
  271. return
  272. }
  273. if(url == '::phone'){
  274. this.$refs.customerServicePopup.open()
  275. return
  276. }
  277. uni.navigateTo({
  278. url
  279. })
  280. },
  281. saveImage(image){
  282. /* 获取图片的信息 */
  283. uni.getImageInfo({
  284. src: image,
  285. success: function(image) {
  286. /* 保存图片到手机相册 */
  287. uni.saveImageToPhotosAlbum({
  288. filePath: image.path,
  289. success: function() {
  290. uni.showModal({
  291. title: '保存成功',
  292. content: '图片已成功保存到相册',
  293. showCancel: false
  294. });
  295. },
  296. complete(res) {
  297. console.log(res);
  298. }
  299. });
  300. }
  301. });
  302. },
  303. },
  304. }
  305. </script>
  306. <style scoped lang="scss">
  307. .page {
  308. position: relative;
  309. .bg-color {
  310. width: 100%;
  311. position: absolute;
  312. top: 0;
  313. left: 0;
  314. height: 550rpx;
  315. background: linear-gradient(to bottom, #88D259, #88D259, #fff);
  316. }
  317. .page-title {
  318. position: relative;
  319. margin-left: 30rpx;
  320. margin-bottom: 30rpx;
  321. }
  322. .search {
  323. position: relative;
  324. background: #FFFFFF;
  325. margin: 20rpx;
  326. border-radius: 41rpx;
  327. padding: 10rpx 20rpx;
  328. display: flex;
  329. align-items: center;
  330. /deep/ .uv-search__action {
  331. background-color: $uni-color;
  332. color: #FFFFFF;
  333. padding: 10rpx 20rpx;
  334. border-radius: 30rpx;
  335. }
  336. }
  337. .swipe {
  338. position: relative;
  339. overflow: hidden;
  340. border-radius: 20rpx;
  341. margin: 20rpx;
  342. }
  343. .menu {
  344. margin: 20rpx;
  345. border-radius: 20rpx;
  346. padding: 20rpx;
  347. background-color: #fff;
  348. box-shadow: 0 0 10rpx 10rpx #00000009;
  349. image {
  350. width: 80rpx;
  351. height: 80rpx;
  352. margin-top: 10rpx;
  353. }
  354. .menu-text {
  355. font-size: 28rpx;
  356. margin-bottom: 10rpx;
  357. margin-top: 10rpx;
  358. }
  359. }
  360. .notice {
  361. margin: 0 20rpx;
  362. /deep/ .uv-notice-bar {
  363. background: linear-gradient(to right, #f9edc9, #dfedd6);
  364. border-radius: 16rpx;
  365. }
  366. /deep/ .uv-notice {
  367. padding: 14rpx 0;
  368. }
  369. /deep/ .uv-icon__icon {
  370. font-size: 36rpx !important;
  371. color: #000 !important;
  372. }
  373. }
  374. .map {
  375. margin: 20rpx;
  376. border-radius: 16rpx;
  377. image {
  378. width: 100%;
  379. height: 100rpx;
  380. }
  381. }
  382. .commodity {
  383. display: flex;
  384. justify-content: center;
  385. align-items: center;
  386. margin: 20rpx;
  387. border-radius: 16rpx;
  388. background-color: #fff;
  389. .box {
  390. width: 100%;
  391. margin: 20rpx;
  392. .top {
  393. display: flex;
  394. border-left: 6rpx solid #A3D250;
  395. align-items: center;
  396. justify-content: space-between;
  397. .top-text {
  398. margin-left: 20rpx;
  399. view:nth-child(1) {
  400. font-size: 24rpx;
  401. color: #474747;
  402. }
  403. view:nth-child(2) {
  404. font-size: 32rpx;
  405. color: #A3D250;
  406. font-weight: 600;
  407. }
  408. }
  409. .top1 {
  410. font-size: 26rpx;
  411. color: #fff;
  412. padding: 10rpx 30rpx;
  413. background-color: #F6CD59;
  414. border-radius: 30rpx;
  415. }
  416. }
  417. }
  418. .centre {
  419. margin: 40rpx 20rpx;
  420. display: flex;
  421. flex-direction: column;
  422. align-items: center;
  423. justify-content: center;
  424. .boxs {
  425. display: flex;
  426. width: 100%;
  427. align-items: center;
  428. justify-content: center;
  429. margin-top: 20rpx;
  430. background-color: #f9f9f9;
  431. border-radius: 20rpx;
  432. padding: 20rpx;
  433. .images {
  434. width: 180rpx;
  435. height: 140rpx;
  436. flex-shrink: 0;
  437. border-radius: 8rpx;
  438. overflow: hidden;
  439. image {
  440. width: 100%;
  441. height: 100%;
  442. }
  443. }
  444. .box-fone {
  445. margin-left: 20rpx;
  446. flex: 1;
  447. view:nth-child(1) {
  448. font-size: 36rpx;
  449. color: #474747;
  450. }
  451. view:nth-child(2) {
  452. margin-top: 10rpx;
  453. font-size: 28rpx;
  454. color: #A2A2A2;
  455. }
  456. }
  457. .box-text,
  458. .box-img {
  459. flex: 1;
  460. }
  461. .box-img{
  462. height: 220rpx;
  463. image{
  464. width: 100%;
  465. height: 100%;
  466. }
  467. }
  468. .box-text {
  469. view:nth-child(1) {
  470. font-size: 32rpx;
  471. font-weight: 500;
  472. margin-top: 30rpx;
  473. }
  474. view:nth-child(2) {
  475. font-size: 28rpx;
  476. color: #CCCCCC;
  477. margin-bottom: 30rpx;
  478. }
  479. .text1 {
  480. color: red;
  481. font-size: 68rpx;
  482. }
  483. .text2 {
  484. font-size: 28rpx;
  485. color: #CCCCCC;
  486. }
  487. }
  488. .box-img {
  489. image {
  490. height: 100%;
  491. width: 100%;
  492. }
  493. }
  494. }
  495. }
  496. }
  497. .qr {
  498. margin-top: 40rpx;
  499. .scan {
  500. text-align: center;
  501. font-size: 28rpx;
  502. color: #A2A2A2;
  503. }
  504. .qr-scan {
  505. margin: 20rpx auto;
  506. width: 400rpx;
  507. height: 400rpx;
  508. image {
  509. height: 100%;
  510. width: 100%;
  511. }
  512. }
  513. .qr-bottom {
  514. display: flex;
  515. font-size: 28rpx;
  516. color: #A2A2A2;
  517. justify-content: space-around;
  518. padding-bottom: 20rpx;
  519. view {
  520. border: 2rpx solid #A2A2A2;
  521. padding: 20rpx;
  522. border-radius: 45rpx;
  523. }
  524. }
  525. }
  526. }
  527. </style>