用户中心接口,商品接口
This commit is contained in:
@@ -5,9 +5,7 @@
|
||||
* moduleName: 订单
|
||||
*/
|
||||
|
||||
import {
|
||||
request
|
||||
} from '../index'
|
||||
import { request } from '../index'
|
||||
|
||||
export {
|
||||
|
||||
|
||||
27
apis/interfaces/store.js
Normal file
27
apis/interfaces/store.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Web唐明明
|
||||
* 匆匆数载恍如梦,岁月迢迢华发增。
|
||||
* 碌碌无为枉半生,一朝惊醒万事空。
|
||||
* moduleName: 商城
|
||||
*/
|
||||
|
||||
import { request } from '../index'
|
||||
|
||||
// 商城
|
||||
const mall = () =>{
|
||||
return request({
|
||||
url: 'mall'
|
||||
})
|
||||
}
|
||||
|
||||
// 商品详情
|
||||
const goods = (id) => {
|
||||
return request({
|
||||
url: 'mall/goods/' + id
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
mall,
|
||||
goods
|
||||
}
|
||||
19
apis/interfaces/user.js
Normal file
19
apis/interfaces/user.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Web唐明明
|
||||
* 匆匆数载恍如梦,岁月迢迢华发增。
|
||||
* 碌碌无为枉半生,一朝惊醒万事空。
|
||||
* moduleName: 用户
|
||||
*/
|
||||
|
||||
import { request } from '../index'
|
||||
|
||||
// 用户
|
||||
const info = () =>{
|
||||
return request({
|
||||
url: 'user/info'
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
info
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<view class="tool-flex-item" @click="$Router.back()">
|
||||
<uni-icons type="closeempty" size="22" color="#666"></uni-icons>
|
||||
</view>
|
||||
<view class="tool-flex-item" @click="onKeyAuth()" v-if="$Route.query.keyPhone === '1'">一键登录</view>
|
||||
<view class="tool-flex-item" @click="onKeyAuth()" v-if="$Route.query.keyPhone == 1">一键登录</view>
|
||||
</view>
|
||||
<!-- 欢迎使用 -->
|
||||
<view class="header">
|
||||
@@ -52,11 +52,7 @@
|
||||
code : this.code
|
||||
}).then(res => {
|
||||
this.$store.commit('setToken', res.token_type + ' ' + res.access_token)
|
||||
if(this.$Route.toName){
|
||||
this.$Router.back()
|
||||
}else{
|
||||
this.$Router.replaceAll({name: 'Index'})
|
||||
}
|
||||
this.$Router.back()
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
|
||||
@@ -3,64 +3,31 @@
|
||||
<!-- 产品封面 -->
|
||||
<view class="goods-swiper">
|
||||
<swiper :indicator-dots="false" @change="current = $event.detail.current + 1">
|
||||
<swiper-item>
|
||||
<swiper-item v-for="(item, index) in goods.pictures" :key="index">
|
||||
<view class="swiper-cover">
|
||||
<image src="https://yanxuan-item.nosdn.127.net/ec5550bf450f6c65a9610a4c891e217b.jpg" mode="aspectFill" />
|
||||
</view>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<view class="swiper-cover">
|
||||
<image src="https://yanxuan-item.nosdn.127.net/dc27864b72701e31286ca2bf6f7bb245.jpg" mode="aspectFill" />
|
||||
</view>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<view class="swiper-cover">
|
||||
<image src="https://yanxuan-item.nosdn.127.net/d89f1f13c36c178843f3bd46783f5ad5.jpg" mode="aspectFill" />
|
||||
<image :src="item" mode="aspectFill" />
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="swiper-pages">
|
||||
{{current}}/3
|
||||
{{current}}/{{goods.pictures.length}}
|
||||
</view>
|
||||
</view>
|
||||
<!-- 详情 -->
|
||||
<view class="main">
|
||||
<view class="title">学生奶 3.8g乳蛋白娟姗纯牛奶 250ml*10盒</view>
|
||||
<view class="sub-title">1%英国珍稀牛种,优级口感与营养</view>
|
||||
<view class="title">{{goods.name}}</view>
|
||||
<view class="sub-title">{{goods.description}}</view>
|
||||
<view class="box-flex">
|
||||
<view class="price">
|
||||
<text>¥</text>59.9
|
||||
<text>¥</text>{{goods.price.show}}
|
||||
</view>
|
||||
<view class="sales">销量2w+</view>
|
||||
<view class="sales">销量{{goods.sales}}</view>
|
||||
</view>
|
||||
<!-- <view class="">
|
||||
优惠券
|
||||
</view> -->
|
||||
<view class="hr">
|
||||
<text>详情</text>
|
||||
</view>
|
||||
<view class="imgs">
|
||||
<image src="https://yanxuan-item.nosdn.127.net/eb6eb62a213c1e76e0326f5d77a5e42b.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/8e132a1d2abfc4ff32fad1cd276c3919.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/7485537552e686ca160509b00366d669.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/6fb77ef6204c5e8f695bf54332c74d23.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/27b53bdb3f3131fffd6e50c42dc0468b.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/7d579166b8dd4e32d23bb9b27a02d2e2.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/ce118328a061c332bfe4b7748518b2d3.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/ae47948c2759ac93baba75ee06d657be.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/f46ccd3139cb9c80e583ab52cb8fb296.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/0ee8478ae77fd561b30d1a5b2124fcd8.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/a856fa0c20fd795aac7e9e6a196db901.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/24926a19f720d8a942c44e228e3c6ec9.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/c1db9a998a66646ce659db57b8c2ec6e.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/a85e0b32e5790a287a95146f6fb266ed.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/38c337287af16dce85634d870cb3db41.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/6e4bdbf6c2945f1c8a3f62344f2056fe.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/24460591cf09176f77082a86a8b03dae.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/85d57e7b3c8e1cdcff5a19ce8f01ceaf.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/2ebe43401d79a59c630ce086852f8d60.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/026cfd7317a40ec2950183461c0e1ee1.jpg" mode="widthFix"></image>
|
||||
<image src="https://yanxuan-item.nosdn.127.net/397bad0e51e14b64664c8e365aea3266.jpg" mode="widthFix"></image>
|
||||
<rich-text :nodes="goods.content"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 立即购买 -->
|
||||
@@ -71,17 +38,34 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { goods } from '@/apis/interfaces/store'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
current: 1
|
||||
current: 1,
|
||||
goods : {
|
||||
pictures : [],
|
||||
name : "",
|
||||
description : "",
|
||||
content : [],
|
||||
price : {
|
||||
show: 0
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getGoods()
|
||||
},
|
||||
methods:{
|
||||
buy(){
|
||||
uni.navigateTo({
|
||||
url: "./buy"
|
||||
getGoods(){
|
||||
goods(this.$Route.query.id).then(res => {
|
||||
console.log(res)
|
||||
this.goods = res
|
||||
})
|
||||
},
|
||||
buy(){
|
||||
console.log(buy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,16 +4,14 @@
|
||||
<view class="swiper">
|
||||
<view class="swiper-box">
|
||||
<swiper autoplay @change="swiperCount = $event.detail.current">
|
||||
<swiper-item>
|
||||
<image src="https://yanxuan.nosdn.127.net/static-union/163971170765382b.jpg" mode="aspectFill"></image>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<image src="https://yanxuan.nosdn.127.net/948240ec17accbb8bb2184bde9b62e8f.jpg" mode="aspectFill"></image>
|
||||
<swiper-item v-for="(item, index) in banners" :key="index">
|
||||
<image :src="item.cover" mode="aspectFill"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="swiper-pages">
|
||||
<text class="pages-item" :class="{'show':swiperCount === 0}"></text>
|
||||
<text class="pages-item" :class="{'show':swiperCount === 1}"></text>
|
||||
<block v-for="(item, index) in banners" :key="index">
|
||||
<text class="pages-item" :class="{'show':swiperCount === index}"></text>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -41,12 +39,12 @@
|
||||
</view>
|
||||
<!-- 推荐品类 -->
|
||||
<view class="card-box">
|
||||
<view class="card-box-item">
|
||||
<view class="card-box-item" style="backgrond: #fef2ae">
|
||||
<view class="card-title">宝贝爱吃</view>
|
||||
<view class="card-subtitle">精选食谱 三餐美味</view>
|
||||
<image class="card-cover" src="@/static/store/store_icon_00.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="card-box-item">
|
||||
<view class="card-box-item" style="backgrond: #c9ead9">
|
||||
<view class="card-title">轻卡小食</view>
|
||||
<view class="card-subtitle">火热商品 一目了然</view>
|
||||
<image class="card-cover" src="@/static/store/store_icon_01.png" mode="aspectFill"></image>
|
||||
@@ -54,123 +52,44 @@
|
||||
</view>
|
||||
<!-- goods -->
|
||||
<view class="goods-box">
|
||||
<!-- <u-divider text="猜你喜欢"></u-divider> -->
|
||||
<!-- <view class="title">猜你喜欢</view> -->
|
||||
<oct-goods
|
||||
:lists="goodsArr"
|
||||
color="#e6576b"
|
||||
@onGoods="onGoods"
|
||||
@onGoods="$Router.push({ name: 'StoreGoods', params: {id: $event.goods_id}})"
|
||||
/>
|
||||
<u-loadmore status="loading" />
|
||||
<!-- <u-loadmore status="loading" /> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mall } from "@/apis/interfaces/store"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
swiperCount: 0,
|
||||
goodTabs: [
|
||||
{ name: "减脂小白", cover: "https://yanxuan.nosdn.127.net/c6fd8835a6400b7da7a016ad85506b69.png"},
|
||||
{ name: "10斤挑战", cover: "https://yanxuan.nosdn.127.net/fede8b110c502ec5799702d5ec824792.png"},
|
||||
{ name: "控卡主食", cover: "https://yanxuan.nosdn.127.net/896a3beac514ae8f40aafe028e5fec56.png"},
|
||||
{ name: "轻卡小食", cover: "https://yanxuan.nosdn.127.net/37520d1204a0c55474021b43dac2a69e.png"},
|
||||
{ name: "肠胃呵护", cover: "https://yanxuan.nosdn.127.net/6c3bd9d885c818b1f73e497335a68b47.png"},
|
||||
{ name: "燃力嗨吃", cover: "https://yanxuan.nosdn.127.net/559d2a240ec20b096590a902217009ff.png"},
|
||||
{ name: "10斤挑战", cover: "https://yanxuan.nosdn.127.net/5c088559ebcc3f0ffcda663f04dfbeb2.png"},
|
||||
],
|
||||
newGood : [
|
||||
{
|
||||
cover : "https://yanxuan-item.nosdn.127.net/0aabfb9974965f4983fcc71344022dc7.png",
|
||||
name : "蜂蜜山楂条",
|
||||
description : "酸甜软糯,松脆不粘牙",
|
||||
price : {
|
||||
price_min: 13
|
||||
}
|
||||
},{
|
||||
cover : "https://yanxuan-item.nosdn.127.net/1b9003483b0c429403477cad336aa9d7.png",
|
||||
name : "卤汁牛肉",
|
||||
description : "松软蛋糕,浓醇奶香",
|
||||
price : {
|
||||
price_min: 39
|
||||
}
|
||||
},{
|
||||
cover : "https://yanxuan-item.nosdn.127.net/ca123e1f1fac9af57df06a14d91e6417.png",
|
||||
name : "东北开口松子",
|
||||
description : "醇正松香,壳薄肉厚",
|
||||
price : {
|
||||
price_min: 42.8
|
||||
}
|
||||
},{
|
||||
cover : "https://yanxuan-item.nosdn.127.net/b2aac81d1116fb3e4d2a747896064bdd.png",
|
||||
name : "蓝莓果干",
|
||||
description : "苹果汁浸泡,无蔗糖添加",
|
||||
price : {
|
||||
price_min: 19
|
||||
}
|
||||
}
|
||||
],
|
||||
goodsArr: [
|
||||
{
|
||||
goods_id : "",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/6d48e6ea51a06b1356ccda21497fdb14.png",
|
||||
name : "茅台王子酒 金王子 53度 500毫升",
|
||||
description : "酱香突出,优雅细腻",
|
||||
price : {
|
||||
price_min: 275
|
||||
}
|
||||
},{
|
||||
goods_id : "",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/87357968bc1d8d8334557148d15296da.png",
|
||||
name : "飞天53%vol 500ml贵州茅台酒(带杯)",
|
||||
description : "茅台飘香,正品溯源",
|
||||
price : {
|
||||
price_min: 1499
|
||||
}
|
||||
},{
|
||||
goods_id : "",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/57a95961e03552e8583d670431d68b92.png",
|
||||
name : "赖茅酒 传承蓝 53度 500毫升*6瓶",
|
||||
description : "传统酱香典范",
|
||||
price : {
|
||||
price_min: 2928
|
||||
}
|
||||
},{
|
||||
goods_id : "",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/e83ebcf07e511c3ef24e2f2845ad0a28.jpg",
|
||||
name : "开盖即食,冰糖银耳莲子羹 280克*9杯",
|
||||
description : "开盖即食,清甜软糯",
|
||||
price : {
|
||||
price_min: 50
|
||||
}
|
||||
},{
|
||||
goods_id : "",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/5a7e0c73b731f5c18941697dc7e1b522.jpg",
|
||||
name : "奶油鸡蛋卷 150克(5袋)",
|
||||
description : "香浓蛋味 入口即化",
|
||||
price : {
|
||||
price_min: 13.9
|
||||
}
|
||||
},{
|
||||
goods_id : "",
|
||||
cover : "https://balenciaga.dam.kering.com/m/611d17da66cdafac/Large-6801252104T1169_D.jpg",
|
||||
name : "Hacker graffiti medium tote bag in canvas jacquard",
|
||||
description : "Coming soon",
|
||||
price : {
|
||||
price_min: 13.9
|
||||
}
|
||||
}
|
||||
]
|
||||
swiperCount : 0,
|
||||
banners : [],
|
||||
goodTabs : [],
|
||||
newGood : [],
|
||||
goodsArr : []
|
||||
};
|
||||
},
|
||||
mounted(){
|
||||
this.getMall()
|
||||
},
|
||||
methods:{
|
||||
onGoods(val){
|
||||
console.log(val)
|
||||
uni.navigateTo({
|
||||
url: "./goods"
|
||||
getMall(){
|
||||
mall().then(res => {
|
||||
this.banners = res.banners
|
||||
this.goodsArr = res.goods
|
||||
this.newGood = res.news
|
||||
this.goodTabs = res.categories
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.getMall()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -236,11 +155,13 @@
|
||||
font-weight: bold;
|
||||
color: $text-color;
|
||||
line-height: 40rpx;
|
||||
@extend .nowrap;
|
||||
}
|
||||
.card-subtitle{
|
||||
font-size: 20rpx;
|
||||
color: $text-gray;
|
||||
line-height: 40rpx;
|
||||
@extend .nowrap;
|
||||
}
|
||||
.card-cover{
|
||||
width: 80rpx;
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<!-- <view class="user-demo">
|
||||
<view @click="$Router.push({name: 'Address'})">地址管理</view>
|
||||
<view @click="$Router.push({name: 'Order'})">订单管理</view>
|
||||
</view> -->
|
||||
<!-- 用户信息 -->
|
||||
<view class="info-box">
|
||||
<image src="@/static/user/user_back.png" mode="aspectFill"></image>
|
||||
<view class="user-flex">
|
||||
<image class="cover" src="@/static/dev/cover.jpg" mode="aspectFill"></image>
|
||||
<image class="cover" :src="userInfo.avatar || require('@/static/user/cover.png')" mode="aspectFill"></image>
|
||||
<view class="user-content">
|
||||
<block v-if="$store.state.token != ''">
|
||||
<view class="name">唐明明</view>
|
||||
<view class="name">{{userInfo.nickname}}</view>
|
||||
<view class="tabs">
|
||||
<view class="tabs-item"><image src="@/static/user/icon_07.png"></image>会员</view>
|
||||
</view>
|
||||
@@ -115,19 +111,32 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { info } from '@/apis/interfaces/user'
|
||||
import userAuth from '@/public/userAuth'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
cardText: ['老用户专属特权', '老用户专属健康会员']
|
||||
cardText: ['老用户专属特权', '老用户专属健康会员'],
|
||||
userInfo: {
|
||||
nickname: "",
|
||||
avatar : ""
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
uni.setNavigationBarTitle({
|
||||
title: "唐明明"
|
||||
})
|
||||
onShow() {
|
||||
this.getInfo()
|
||||
},
|
||||
methods:{
|
||||
// 用户信息
|
||||
getInfo(){
|
||||
if(this.$store.state.token === '') return
|
||||
info().then(res => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.nickName
|
||||
})
|
||||
this.userInfo = res
|
||||
})
|
||||
},
|
||||
// 登录
|
||||
Login(){
|
||||
const Auth = new userAuth()
|
||||
@@ -181,6 +190,7 @@
|
||||
line-height: 40rpx;
|
||||
font-weight: bold;
|
||||
font-size: $title-size + 8;
|
||||
@extend .nowrap;
|
||||
}
|
||||
.tabs{
|
||||
padding-top: 10rpx;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import {
|
||||
RouterMount,
|
||||
createRouter
|
||||
} from 'uni-simple-router';
|
||||
import { RouterMount, createRouter } from 'uni-simple-router';
|
||||
import store from '@/store/index'
|
||||
|
||||
const router = createRouter({
|
||||
platform: process.env.VUE_APP_PLATFORM,
|
||||
|
||||
BIN
static/user/cover.png
Normal file
BIN
static/user/cover.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user