Commit 676d4a1e authored by sheng du's avatar sheng du
Browse files

接口调试

parent f6f4a030
import http from './http'
export default {
// 项目分页
projectPage(data: ParameterType) {
return http.post('/sysApi/ipProjectEntity/page', data)
},
}
import http from './http'
export default {
// 分类列表
classList(params : any) {
return http.get('/prod-api/yimei/goodsClass/list', { params });
},
// banner获取
xcxbanner(params : any) {
return http.get('/prod-api/biz/xcxbanner', { params });
},
// 小程序用户协议
userAgreement(params : any) {
return http.get('/prod-api/biz/user_agreement', { params });
},
}
\ No newline at end of file
/**
* http 请求封装
* @author tangsj
* @param {*} url 请求地址
* @param {*} options 请求参数
*/
import config from '../config'
import utils from '../utils'
import { useUserStore } from '@/stores/modules/user'
// 记录请求中的请求数,控制loading显示
let requestCount = 0
let hasError = false
export function fetch(url: string, options: ParameterType) {
const userStore = useUserStore()
const header = {
Authorization: userStore.token,
}
options = Object.assign(
{
loading: true,
method: 'GET',
data: {},
holdTip: false,
},
options
)
return new Promise((resolve, reject) => {
if (requestCount === 0 && options.loading) {
hasError = false
uni.showLoading({
title: '加载中...',
})
}
requestCount += 1
uni.request({
url: `${config.apiRoot}${url}`,
data: options.data,
method: options.method,
header,
success: (res: ParameterType) => {
if (
res.statusCode < 200 ||
res.statusCode > 300 ||
Number(res.data.code) !== 200
) {
if (!options.holdTip) {
uni.showToast({
title: res.data.msg || '服务器异常!',
icon: 'none',
})
hasError = true
}
if (res.data.code == 5001) {
uni.reLaunch({
url: '/pages/login/index',
})
}
return reject(res.data || {})
}
return resolve(res.data || {})
},
fail: () => {
hasError = true
uni.showToast({
title: '服务器异常!',
icon: 'none',
})
reject({
msg: '服务器异常!',
})
},
complete: () => {
requestCount -= 1
if (requestCount === 0 && options.loading) {
if (hasError) {
setTimeout(() => {
uni.hideLoading()
}, 2000)
} else {
uni.hideLoading()
}
}
},
})
})
}
const http = {
get(url: string, data: ParameterType = {}, options = {}) {
return fetch(url, {
method: 'GET',
data: data.params,
...options,
})
},
post(url: string, data: ParameterType = {}, options = {}) {
if (data.params) {
// 将param放到url 参数里面
const query = utils.buildQueryString(data.params)
url += `?${query}`
delete data.params
}
return fetch(url, {
method: 'POST',
data,
...options,
})
},
}
export default http
/**
* http 请求封装
* @author tangsj
* @param {*} url 请求地址
* @param {*} options 请求参数
*/
import config from '../config'
import utils from '../utils'
import { useUserStore } from '@/stores/modules/user'
// 记录请求中的请求数,控制loading显示
let requestCount = 0
let hasError = false
export function fetch(url : string, options : ParameterType) {
const userStore : any = useUserStore()
const storeInfo : any = uni.getStorageSync('store')
let header : any = {
Authorization: userStore.access_token ? 'Bearer ' + userStore.access_token : '',
Clientid: userStore.client_id || '',
// Storeid: '1796391508407816194',
// Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJzeXNfdXNlcjoxIiwicm5TdHIiOiIzZ2pQckNmNU0yUHNXYU5zMTNvc2ZCZ0x4cVBQc1dCeiIsImNsaWVudGlkIjoiZTVjZDdlNDg5MWJmOTVkMWQxOTIwNmNlMjRhN2IzMmUiLCJ0ZW5hbnRJZCI6IjAwMDAwMCIsInVzZXJJZCI6MSwiZGVwdElkIjoxMDN9.QVrKJ1BjTsRQ6GP_YmjZrwwbEkw2qLuavwJs5plD0dQ"
}
if (storeInfo) {
header.Storeid = storeInfo.id
}
// console.log(header);
options = Object.assign(
{
loading: true,
method: 'GET',
data: {},
holdTip: false,
},
options
)
return new Promise((resolve, reject) => {
if (requestCount === 0 && options.loading) {
hasError = false
uni.showLoading({
title: '加载中...',
})
}
requestCount += 1
uni.request({
url: `${config.apiRoot}${url}`,
data: options.data,
method: options.method,
header,
success: (res : ParameterType) => {
if (url == '/prod-api/yimei/cashier/list') {
return resolve(res.data || {})
}
if (
res.statusCode < 200 ||
res.statusCode > 300 ||
Number(res.data.code) !== 200
) {
if (!options.holdTip) {
uni.showToast({
title: res.data.msg || '服务器异常!',
icon: 'none',
})
hasError = true
}
if (res.data.code == 401) {
userStore.clearUsers()
setTimeout(() => {
uni.navigateTo({
url: '/pages/login/index',
})
}, 800)
}
return reject(res.data || {})
}
return resolve(res.data || {})
},
fail: () => {
hasError = true
uni.showToast({
title: '服务器异常!',
icon: 'none',
})
reject({
msg: '服务器异常!',
})
},
complete: () => {
requestCount -= 1
if (requestCount === 0 && options.loading) {
if (hasError) {
setTimeout(() => {
uni.hideLoading()
}, 2000)
} else {
uni.hideLoading()
}
}
},
})
})
}
const http = {
get(url : string, data : ParameterType = {}, options = {}) {
return fetch(url, {
method: 'GET',
data: data.params,
...options,
})
},
post(url : string, data : ParameterType = {}, options = {}) {
if (data.params) {
// 将param放到url 参数里面
const query = utils.buildQueryString(data.params)
url += `?${query}`
delete data.params
}
return fetch(url, {
method: 'POST',
data,
...options,
})
},
put(url : string, data : ParameterType = {}, options = {}) {
if (data.params) {
// 将param放到url 参数里面
const query = utils.buildQueryString(data.params)
url += `?${query}`
delete data.params
}
return fetch(url, {
method: 'PUT',
data,
...options,
})
},
}
export default http
\ No newline at end of file
const files: any = import.meta.globEager('./*.ts')
const modules: any = {}
Object.keys(files).forEach(key => {
if (key === './index.ts' || key === './http.ts') return
const reg = /^\.\/(.*)\.ts$/
const m: any = key.match(reg)
if (m[1]) {
modules[m[1]] = files[key].default
}
})
export default modules
const files : any = import.meta.globEager('./*.ts')
const modules : any = {}
Object.keys(files).forEach(key => {
if (key === './index.ts' || key === './http.ts') return
const reg = /^\.\/(.*)\.ts$/
const m : any = key.match(reg)
if (m[1]) {
modules[m[1]] = files[key].default
}
})
export default modules
\ No newline at end of file
import http from './http'
export default {
//查询附近多少米内的门店管理列表
storeListByPoint(params : any) {
return http.get('/prod-api/yimei/store/listByPoint', { params });
},
// 分类列表
classList(params : any) {
return http.get('/prod-api/yimei/goodsClass/list', { params });
},
// 通知列表
noticeList(params : any) {
return http.get('/prod-api/system/notice/list', { params });
},
//通知详情
noticeInfo(data : any) {
return http.get(`/prod-api/system/notice/${data.id}`);
},
//收银台商品列表
cashierList(params : any) {
return http.get(`/prod-api/yimei/cashier/list`, { params });
},
// 获取商品管理详细信息
goodsInfo(params : any) {
return http.get('/prod-api/yimei/goods/' + params.id, { params });
},
// 获取套餐管理详细信息
goodsPackageInfo(params : any) {
return http.get('/prod-api/yimei/goodsPackage/' + params.id, { params });
},
// 获取品牌详情
brandInfo(params : any) {
return http.get(`/prod-api/yimei/brand/${params.id}`, { params });
},
}
\ No newline at end of file
......@@ -7,10 +7,19 @@ export default {
* @param {*} data
* @returns
*/
login(data: ParameterType) {
return http.post('/sysApi/login', data)
login(data: any) {
return http.post('/prod-api/auth/loginByPhone', data)
},
logout(data: ParameterType) {
logout(data: any) {
return http.post('/sysApi/logout', data)
},
getUserInfo(params : any) {
return http.get('/prod-api/system/user/getInfo', { params });
},
editBankCards(data: any) {
return http.put('/prod-api/yimei/customer/editBankCards',data);
},
editAddress(data: any) {
return http.put('/prod-api/yimei/customer/editAddress',data);
},
}
//#ifdef H5
const baseUrl = ''
//#endif
// //#ifdef H5
// const baseUrl = ''
// //#endif
//#ifndef H5
const baseUrl = 'https://www.gorho.cn'
//#endif
// //#ifndef H5
// const baseUrl = 'https://www.gorho.cn'
// //#endif
const baseUrl = 'http://47.109.57.88'
const imageView = 'https://www.gorho.cn'
const imageView = 'http://47.109.57.88/res'
export default {
baseUrl,
......
//#ifdef H5
const baseUrl = ''
//#endif
//#ifndef H5
const baseUrl = 'https://www.gorho.cn'
//#endif
const imageView = 'https://www.gorho.cn'
export default {
baseUrl,
imageView,
}
// //#ifdef H5
// const baseUrl = ''
// //#endif
// //#ifndef H5
// const baseUrl = 'https://www.gorho.cn'
// //#endif
const baseUrl = 'http://47.109.57.88'
const imageView = 'http://47.109.57.88/res'
export default {
baseUrl,
imageView,
}
\ No newline at end of file
......@@ -2,14 +2,13 @@ import { createSSRApp } from 'vue'
import * as Pinia from 'pinia'
import App from './App.vue'
import CustomNav from "@/components/CustomNav/index.vue"
import plugins from './plugins'
export function createApp() {
const app = createSSRApp(App)
app.component('CustomNav', CustomNav)
app.use(Pinia.createPinia())
app.use(plugins)
......@@ -18,4 +17,4 @@ export function createApp() {
Pinia,
plugins,
}
}
}
\ No newline at end of file
{
"name" : "仙颜御定会员服务",
"appid" : "__UNI__7F820D6",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* 模块配置 */
"modules" : {},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios打包配置 */
"ios" : {},
/* SDK配置 */
"sdkConfigs" : {}
}
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "wx76bb5e310258b093",
"setting" : {
"urlCheck" : false,
"minified" : true,
"es6" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3"
}
{
"name": "仙颜御定会员服务",
"appid": "__UNI__7F820D6",
"description": "",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
/* 5+App特有相关 */
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
/* 模块配置 */
"modules": {},
/* 应用发布信息 */
"distribute": {
/* android打包配置 */
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios打包配置 */
"ios": {},
/* SDK配置 */
"sdkConfigs": {}
}
},
/* 快应用特有相关 */
"quickapp": {},
/* 小程序特有相关 */
"mp-weixin": {
"appid": "wx76bb5e310258b093",
"setting": {
"urlCheck": false,
"minified": true,
"es6": false
},
"usingComponents": true,
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"requiredPrivateInfos": ["getLocation"]
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false
},
"vueVersion": "3"
}
\ No newline at end of file
......@@ -9,22 +9,19 @@
<view class="flex between align-center search-line">
<view class="address flex align-center">
<image src="../../static/icons/address.png" style="width: 24rpx;height: 28rpx;" mode=""></image>
<text>重庆渝北店</text>
<picker :value="storeIndex" :range="storeList" @change="changeStore" range-key="name">
<text>{{nearStore.name ||'获取中...'}}</text>
</picker>
</view>
<view class="search flex align-center" @click="toSearch">
<image src="../../static/icons/search.png" style="width: 32rpx;height: 32rpx;" mode=""></image>
<input type="text" value="" placeholder="请输入商品名称" />
</view>
</view>
<swiper class="swiper" circular>
<swiper-item>
<swiper class="swiper" circular indicator-dots>
<swiper-item v-for="(item,index) in bannerList" :key="index">
<view class="swiper-item uni-bg-red">
<image src="../../static/images/banner.png" class="banner-img" mode=""></image>
</view>
</swiper-item>
<swiper-item>
<view class="swiper-item uni-bg-red">
<image src="../../static/images/banner.png" class="banner-img" mode=""></image>
<image :src="item.imgUrl" class="banner-img" mode=""></image>
</view>
</swiper-item>
</swiper>
......@@ -32,14 +29,25 @@
<view class="menus">
<view class="list">
<view class="item" v-for="(item, index) in menuList" :key="index">
<image :src="'../../static/images/' + item.icon" mode="" class="menu-icon"></image>
<!-- <image :src="'../../static/images/' + item.icon" mode="" class="menu-icon"></image> -->
<image v-if="item.icon == 'all'" src="../../static/images/menu-icon10.png" mode=""
class="menu-icon"></image>
<image v-else :src="item.icon" mode="" class="menu-icon"></image>
<text>{{ item.name }}</text>
</view>
</view>
<view class="notice flex between align-center" @click="toNotice">
<image src="../../static/images/notice.png" style="width: 48rpx;height: 39rpx;" mode=""></image>
<view class="flex end align-center">
<view class="notice-content">新客到院送面膜/沙发毯,老客到店送进口...</view>
<!-- noticeList -->
<swiper class="notice-content" circular vertical autoplay>
<swiper-item v-for="(item,index) in noticeList" :key="index">
{{item.noticeTitle}}
</swiper-item>
</swiper>
<!-- <view class="notice-content">新客到院送面膜/沙发毯,老客到店送进口...</view> -->
<image src="../../static/icons/notice-right.png" style="width: 32rpx;height: 32rpx;" mode="">
</image>
</view>
......@@ -57,13 +65,13 @@
</view>
</view>
<view class="projects">
<view class="projects-item" v-for="(item,index) in projectList" :key="index"
<view class="projects-item mb-30" v-for="(item,index) in projectList" :key="index"
@click="toProjectDetail(item)">
<image :src="'../../static/images/'+item.imgUrl" mode="" class="projects-item_img"></image>
<image :src="item.imgUrl" mode="" class="projects-item_img"></image>
<view class="projects-item_msgs">
<view class="projects-item_msgs_name">{{item.name}}</view>
<view class="projects-item_msgs_sell">已售{{item.sell}}</view>
<view class="projects-item_msgs_price"><text></text>{{item.price}}</view>
<view class="projects-item_msgs_name">{{item.goodsName}}</view>
<view class="projects-item_msgs_sell">已售{{item.salesQty}}</view>
<view class="projects-item_msgs_price"><text></text>{{item.sellPriceRange}}</view>
</view>
</view>
</view>
......@@ -74,62 +82,179 @@
<script setup lang="ts">
import CustomNav from "@/components/CustomNav/index.vue";
// import api from '@/api'
import api from '@/api'
import config from '@/config'
import { ref, reactive } from 'vue'
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app'
const list = ref<any[]>([
{}, {}, {}
])
const menuList = ref<any[]>([
{
name: '皮肤管理',
icon: 'menu-icon1.png'
}, {
name: '美眼翘鼻',
icon: 'menu-icon2.png'
}, {
name: '玻尿酸',
icon: 'menu-icon3.png'
}, {
name: '美体塑形',
icon: 'menu-icon4.png'
}, {
name: '补水美白',
icon: 'menu-icon5.png'
}, {
name: '瘦脸除皱',
icon: 'menu-icon6.png'
}, {
name: '口腔管理',
icon: 'menu-icon7.png'
}, {
name: '私密护理',
icon: 'menu-icon8.png'
}, {
name: '纹绣/植发',
icon: 'menu-icon9.png'
}, {
name: '全部商品',
icon: 'menu-icon10.png'
// const list = ref<any[]>([
// {}, {}, {}
// ])
//门店获取
const nearStore = ref<any>({})
const storeList = ref<any>([])
const storeIndex = ref<any>()
const storeListByPoint = async (changeStore = true) => {
// api.project.storeListByPoint
uni.getLocation({
type: 'wgs84',
success: function (res) {
// console.log('当前位置的经度:' + res.longitude);
// console.log('当前位置的纬度:' + res.latitude);
uni.showLoading({
title: '正在获取地址',
mask: true,
})
api.project.storeListByPoint({
longitude: res.longitude,
latitude: res.latitude,
distance: 9999999
}).then((storeRes : any) => {
console.log(storeRes.data);
uni.hideLoading()
if (storeRes.data.length) {
// nearStore.value = storeRes.data[0]
// uni.setStorageSync('store', nearStore.value)
let storeListRes = storeRes.data.map((item : any) => {
let [lat, lon] = item.axis.split(',')
return {
...item,
distance: getDistanceFromLatLonInKm(res.latitude, res.longitude, lat, lon)
}
})
storeListRes.sort((a : any, b : any) => a.distance - b.distance);
storeList.value = [...storeListRes]
// let numbers = [3, 1, 4, 1, 5, 9];
if (changeStore) {
// console.log(storeListRes);
storeIndex.value = 0
nearStore.value = storeListRes[0]
uni.setStorageSync('store', nearStore.value)
// console.log(numbers); // 输出: [9, 5, 4, 3, 1, 1]
reGetInfo()
}
}
})
}, fail(err) {
console.log(err);
}
});
}
//切换门店
const changeStore = (e : any) => {
const index = e.detail.value
storeIndex.value = index
nearStore.value = storeList.value[index]
uni.setStorageSync('store', nearStore.value)
reGetInfo()
}
const reGetInfo = () => {
getNavList()
getNoticeList()
getCashierList()
getBannerList()
}
const getDistanceFromLatLonInKm = (lat1 : any, lon1 : any, lat2 : any, lon2 : any) => {
const R = 6371; // 地球平均半径,单位为公里
const dLat = (lat2 - lat1) * (Math.PI / 180);
const dLon = (lon2 - lon1) * (Math.PI / 180);
const lat1Rad = lat1 * (Math.PI / 180);
const lat2Rad = lat2 * (Math.PI / 180);
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1Rad) * Math.cos(lat2Rad);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const d = R * c;
return d;
}
//菜单列表
const menuList = ref<any[]>([])
const getNavList = async () => {
// console.log(api);
menuList.value = []
let res = await api.project.classList()
let mapList : any = [];
if (res.rows?.length) {
// console.log(res.rows);
mapList = res.rows.map((item : any) => {
return {
...item,
icon: `${config.imageView}${item.logoAbsUrl}`
}
})
mapList = mapList.filter((item : any, index : number) => item && index <= 8)
console.log(mapList);
}
])
menuList.value = [...mapList, {
name: '全部商品',
icon: 'all'
}]
console.log(menuList.value);
// res.rows
}
//通知列表
const noticeList = ref<any>([])
const getNoticeList = async () => {
let res = await api.project.noticeList()
// console.log(res);
noticeList.value = [...res.rows]
}
const projectList = ref<any[]>([
{
name: '膨体鼻综合:美植挺垫鼻背+取耳软骨+耳软骨垫鼻',
sell: '2589',
imgUrl: 'goods1.png',
price: '29800.00'
}, {
name: '双效瘦脸:瘦咬肌+消脂肪',
sell: '2589',
imgUrl: 'goods2.png',
price: '29800.00'
}
// {
// name: '膨体鼻综合:美植挺垫鼻背+取耳软骨+耳软骨垫鼻',
// sell: '2589',
// imgUrl: 'goods1.png',
// price: '29800.00'
// }, {
// name: '双效瘦脸:瘦咬肌+消脂肪',
// sell: '2589',
// imgUrl: 'goods2.png',
// price: '29800.00'
// }
])
const page = reactive({
current: 1,
size: 10,
})
//获取商品/套餐列表
const getCashierList = async () => {
let res = await api.project.cashierList({
recommendIndex: 1,
// storeId: nearStore.value.id || ''
})
console.log(res);
projectList.value = []
if (res.length) {
projectList.value = res.map((item : any) => {
let imgUrl = item.goodsLogoAbsUrl.length ? item.goodsLogoAbsUrl[0] : ''
return {
...item,
imgUrl: `${config.imageView}${imgUrl}`,
sellPriceRange: item.sellPriceRange.split('~')[0]
}
})
}
}
const bannerList = ref<any>([])
const getBannerList = async () => {
let res = await api.common.xcxbanner()
console.log(res);
bannerList.value = res.data.map((item : any) => {
return {
...item,
imgUrl: `${config.imageView}${item.image}`,
}
})
}
// cashierList
// const page = reactive({
// current: 1,
// size: 10,
// })
const toSearch = () => {
uni.navigateTo({
url: "/pages/index/search"
......@@ -143,8 +268,9 @@
const toProjectDetail = (item : any) => {
uni.navigateTo({
url: `/pages/shop/projectDetail?id=${item.id}`
url: `/pages/shop/projectDetail?id=${item.goodsId}&goodType=${item.goodType}`
})
}
// toProjectDetail(item)
// const loadStatus = ref('more')
......@@ -169,16 +295,28 @@
// }
// }
// }
onLoad(() => { })
onShow(() => {
list.value = []
page.current = 1
// getPage()
onLoad(() => {
})
onReachBottom(() => {
page.current++
onShow(() => {
const storeInfo = uni.getStorageSync('store')
if (storeInfo && storeInfo.id) {
nearStore.value = storeInfo
storeListByPoint(false)
reGetInfo()
} else {
storeListByPoint()
}
// list.value = []
// page.current = 1
// getPage()
})
// onReachBottom(() => {
// page.current++
// // getPage()
// })
</script>
<style lang="less" scoped>
......@@ -259,6 +397,7 @@
width: 100%;
padding: 20rpx;
padding-top: 12rpx;
height: 356rpx;
.item {
display: flex;
......@@ -298,6 +437,7 @@
line-height: 42rpx;
font-size: 28rpx;
color: #3D3126;
height: 42rpx;
}
}
......
<template>
<view class="pub-page pd-30-x">
<view class="notice-list">
<view class="notice-item" v-for="(item,index) in Array(5)" :key="index" @click="toNoticeDetail">{{item}}
<view class="notice-item" v-for="(item,index) in noticeList" :key="index" @click="toNoticeDetail(item)">
<view class="info bd-bt">
<view class="title">新客到院送面膜/沙发毯,老客到店送进口除皱、弹...</view>
<view class="time">2024-04-11 04:52</view>
<view class="content">文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字 ..</view>
<view class="title">{{item.noticeTitle}}</view>
<view class="time">{{item.createTime}}</view>
<view class="content">
<rich-text v-if="item.noticeContent" :nodes="item.noticeContent"></rich-text>
</view>
</view>
<view class="flex between align-center bottom">
<text>查看详情</text>
......@@ -17,11 +19,56 @@
</template>
<script setup lang="ts">
const toNoticeDetail = () => {
import { ref } from 'vue';
import api from '@/api'
import { onLoad, onReachBottom } from '@dcloudio/uni-app'
const toNoticeDetail = (item : any) => {
uni.navigateTo({
url: "/pages/index/noticeDetail"
url: `/pages/index/noticeDetail?id=${item.noticeId}`
})
}
//分页
const pageNum = ref(1)
const pageSize = ref(10)
const listStatus = ref(1) //1加载更多 2加载中 3没有更多了
//通知列表
const noticeList = ref<any>([])
const getNoticeList = async () => {
// let res = await api.project.noticeList()
// noticeList.value = [...noticeList.value, ...res.rows]
if (listStatus.value != 1) {
return
}
listStatus.value = 2
let res = await api.project.noticeList({
pageNum: pageNum.value,
pageSize: pageSize.value
})
// console.log(res);
if (res.rows?.length) {
noticeList.value = [...noticeList.value, ...res.rows]
if (pageSize.value * pageNum.value < res.total) {
listStatus.value = 1
pageNum.value += 1
} else {
listStatus.value = 3
}
} else {
listStatus.value = 3
}
}
onLoad(() => {
getNoticeList()
})
onReachBottom(() => {
getNoticeList()
})
</script>
<style lang="less" scoped>
......@@ -64,6 +111,8 @@
line-height: 30rpx;
padding-bottom: 28rpx;
color: #666666;
max-height: 300rpx;
overflow-y: hidden;
}
.bottom {
......
<template>
<view class="pub-page pd-30-x">
<view class="title">新客到店送面膜/沙发毯,老客到店送进口除皱、弹力胶原针</view>
<view class="time">2024-04-11 04:52</view>
<view class="content">
文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字
<view class="title">{{content.noticeTitle}}</view>
<view class="time">{{content.createTime}}</view>
<view class="content" v-if="content.noticeContent">
<rich-text :nodes="content.noticeContent"></rich-text>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import api from '@/api'
import { onLoad } from '@dcloudio/uni-app'
const noticeId = ref('')
onLoad((options : any) => {
let { id } = options
if (id) {
noticeId.value = id
getNoticeDetail()
}
})
const content = ref<any>({})
const getNoticeDetail = async () => {
let res = await api.project.noticeInfo({ id: noticeId.value })
console.log(res);
if (res.data) {
content.value = res.data
}
}
</script>
<style lang="less" scoped>
.title{
.title {
padding-top: 50rpx;
line-height: 50rpx;
color: #000000;
}
.time{
.time {
font-size: 24rpx;
color: #999999;
line-height: 36rpx;
padding-top: 9rpx;
}
.content{
.content {
font-size: 28rpx;
color: #666666;
line-height: 40rpx;
......
<template>
<view class="page-index flex column align-center">
<CustomNav>登陆</CustomNav>
<view class="log">
<image src="@/static/logo.png" mode="widthFix" style="width: 188rpx;height: 188rpx;"></image>
<view class="name">韩秀仙颜</view>
</view>
<view class="from">
<Button type="" class="pub-btn">微信授权登录</Button>
<Button type="" class="pub-btn plain">取消登陆</Button>
</view>
</view>
</template>
<script setup lang="ts">
import api from '@/api'
import { ref, getCurrentInstance } from 'vue'
import { useUserStore } from '@/stores/modules/user'
import { Md5 } from 'ts-md5'
import CustomNav from "@/components/CustomNav/index.vue";
const userStore = useUserStore()
const username = ref('')
const password = ref('')
const proxy = getCurrentInstance()?.proxy
const submit = () => {
if (!username.value) {
proxy?.$modal.toast('请输入账号')
return
}
if (!password.value) {
proxy?.$modal.toast('请输入密码')
return
}
const postData = {
username: username.value,
password: Md5.hashStr(password.value),
}
userStore.login(postData).then(() => {
uni.switchTab({
url: '/pages/index/index',
})
})
}
</script>
<style lang="less" scoped>
.page-index {
// padding: 90rpx 0;
box-sizing: border-box;
// background-color: #000 20%;
background: linear-gradient(173.46deg, rgba(222, 204, 204, 0.2) 0%, rgba(209, 197, 188, 0.16) 33.13%, rgba(214, 210, 206, 0.08) 69.08%, rgba(245, 245, 245, 0) 100%);
min-height: 100vh;
.log{
padding-top: 224rpx;
}
.name {
text-align: center;
font-size: 40rpx;
line-height: 57.92rpx;
color: #333333;
padding-top: 24rpx;
padding-bottom: 146rpx;
}
.from {
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
.pub-btn {
margin-bottom: 52rpx;
}
}
}
</style>
<template>
<view class="page-index flex column align-center">
<CustomNav>登陆</CustomNav>
<view class="log">
<image src="@/static/logo.png" mode="widthFix" style="width: 188rpx;height: 188rpx;"></image>
<view class="name">韩秀仙颜</view>
</view>
<view class="from">
<button type="" class="pub-btn" open-type="getPhoneNumber" @getphonenumber="getUserPhone">微信授权登录</button>
<button type="" class="pub-btn plain" @click="cancelLogin">取消登陆</button>
</view>
</view>
</template>
<script setup lang="ts">
import api from '@/api'
import { ref, getCurrentInstance } from 'vue'
import { useUserStore } from '@/stores/modules/user'
// const userStore = useUserStore()
// import { Md5 } from 'ts-md5'
import CustomNav from "@/components/CustomNav/index.vue";
const userStore = useUserStore()
// const username = ref('')
// const password = ref('')
// const proxy = getCurrentInstance()?.proxy
// console.log(userStore.access_token);
const accessToken = ref('')
const getUserPhone = (e : any) => {
// console.log("回调返回的信息:", e)
uni.login({
provider: 'weixin',
success: async (loginRes) => {
// console.log(loginRes);
uni.request({
url: `https://api.weixin.qq.com/sns/jscode2session`,
method: 'GET',
data: {
js_code: loginRes.code,
appid: 'wx76bb5e310258b093',
secret: '28d41b3fbe3d06bfb28616381ceee58f',
grant_type: 'authorization_code'
},
success(userRes : any) {
const openid = userRes.data.openid
uni.request({
url: 'https://api.weixin.qq.com/cgi-bin/stable_token',
method: 'POST',
data: {
appid: 'wx76bb5e310258b093',
secret: '28d41b3fbe3d06bfb28616381ceee58f',
grant_type: 'client_credential'
},
success(res : any) {
// console.log('获取access_token信息:', res)
accessToken.value = res.data.access_token
uni.request({
url: `https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=${res.data.access_token}`,
method: 'POST',
data: {
code: e.detail.code,
},
success(res : any) {
const userPhone = res.data.phone_info.phoneNumber
const storeInfo = uni.getStorageSync('store')
const datas = {
openId: openid,
phone: userPhone,
storeId: storeInfo.id,
nickName: '微信用户'
}
api.user.login(datas).then((res : any) => {
console.log(res);
userStore.updateUsers(res.data)
uni.showToast({
title: '登陆成功',
icon: 'none'
})
userStore.updateUsersInfo()
// getUserInfo()
setTimeout(() => {
uni.navigateBack()
}, 500)
})
// console.log('获取的用户手机号userPhone:', res)
}
})
},
fail(err) {
console.log(err);
}
})
}
})
},
fail: (err) => {
console.log(err);
}
})
}
const cancelLogin = () => {
uni.navigateBack()
}
// const submit = () => {
// if (!username.value) {
// proxy?.$modal.toast('请输入账号')
// return
// }
// if (!password.value) {
// proxy?.$modal.toast('请输入密码')
// return
// }
// const postData = {
// username: username.value,
// password: Md5.hashStr(password.value),
// }
// userStore.login(postData).then(() => {
// uni.switchTab({
// url: '/pages/index/index',
// })
// })
// }
</script>
<style lang="less" scoped>
.page-index {
// padding: 90rpx 0;
box-sizing: border-box;
// background-color: #000 20%;
background: linear-gradient(173.46deg, rgba(222, 204, 204, 0.2) 0%, rgba(209, 197, 188, 0.16) 33.13%, rgba(214, 210, 206, 0.08) 69.08%, rgba(245, 245, 245, 0) 100%);
min-height: 100vh;
.log {
padding-top: 224rpx;
}
.name {
text-align: center;
font-size: 40rpx;
line-height: 57.92rpx;
color: #333333;
padding-top: 24rpx;
padding-bottom: 146rpx;
}
.from {
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
.pub-btn {
margin-bottom: 52rpx;
}
}
}
</style>
\ No newline at end of file
......@@ -2,11 +2,14 @@
<view class="pub-page">
<view class="project">
<view class="project-row-item">
<image src="../../static/images/goods1.png" mode="" class="project-row-item_img"></image>
<image :src="skuInfo.skuImg || content.imgUrls[0]" mode="" class="project-row-item_img"></image>
<view class="project-row-item_info">
<view class="project-row-item_info_name">膨体鼻综合:美植挺垫鼻背+取耳软骨+耳软骨垫鼻</view>
<view class="project-row-item_info_sell">已售2589</view>
<view class="project-row-item_info_price"><text></text>29800.00</view>
<view class="project-row-item_info_name">{{content.name}}</view>
<view class="project-row-item_info_sell">
已售{{skuInfo.outboundQty || skuInfo.outboundQty === 0 ? skuInfo.outboundQty : content.salesQty}}
</view>
<view class="project-row-item_info_price"><text></text>{{skuInfo.sellPrice || content.sellPrice}}
</view>
</view>
</view>
</view>
......@@ -23,10 +26,11 @@
<view class="label">预约门店</view>
<view class="flex align-center end">
<picker @change="storeChange" :value="storeIndex" :range="storeArray">
{{storeInfo.name}}
<!-- <picker @change="storeChange" :value="storeIndex" :range="storeArray">
<view class="uni-input">{{storeArray[storeIndex]}}</view>
</picker>
<image src="../../static/icons/right.png" class="pub-form-item_right_icon" mode=""></image>
</picker> -->
<!-- <image src="../../static/icons/right.png" class="pub-form-item_right_icon" mode=""></image> -->
</view>
</view>
</view>
......@@ -36,13 +40,86 @@
<script setup lang="ts">
import { ref } from 'vue';
const storeIndex = ref(0)
const storeArray = ref(['门店1', '门店2'])
const datetimesingle = ref('')
const storeChange = (e : any) => {
storeIndex.value = e.detail.value
import { onLoad, onShow } from '@dcloudio/uni-app'
import config from '@/config'
import api from '@/api'
const projectId = ref<any>('')
const projectGoodType = ref<any>('')
const goodsSkuId = ref<any>('')
onLoad((options : any) => {
let { id, goodType, skuId } = options
if (skuId) {
goodsSkuId.value = skuId
}
if (id && goodType) {
projectId.value = id
projectGoodType.value = goodType
getProjectDetail()
}
})
const storeInfo = ref<any>({})
onShow(() => {
storeInfo.value = uni.getStorageSync('store')
console.log(storeInfo.value);
})
const content = ref<any>({})
const skuInfo = ref<any>({})
const getProjectDetail = async () => {
let res;
if (projectGoodType.value == 1) {
res = await api.project.goodsInfo({ id: projectId.value })
} else {
res = await api.project.goodsPackageInfo({ id: projectId.value })
}
console.log(res.data);
content.value = {
...res.data,
imgUrls: res.data.imgOssUrl.map((item : any) => {
return `${config.imageView}${item}`
}),
sellPriceRange: res.data.sellPriceRange ? res.data.sellPriceRange.split('~')[0] : '',
marketPriceRange: res.data.marketPriceRange ? res.data.marketPriceRange.split('~')[0] : '',
}
let findSku;
if (content.value.skuList?.length) {
findSku = content.value.skuList.find((item : any) => item.id == goodsSkuId.value)
if (findSku) {
let skuImg = findSku.imgOssUrl || (content.value.imgOssUrl && content.value.imgOssUrl.length ? content.value.imgOssUrl[0] : '')
skuInfo.value = {
...findSku,
skuImg: `${config.imageView}${skuImg}`
}
}
}
if (content.value.brandId) {
// getBrandInfo()
}
// let
// console.log(res);
// if (res.data) {
// content.value = res.data
// }
}
const datetimesingle = ref('')
// const storeIndex = ref(0)
// const storeArray = ref(['门店1', '门店2'])
// const storeChange = (e : any) => {
// storeIndex.value = e.detail.value
// }
const confirmSubmit = () => {
uni.navigateTo({
url: "/pages/shop/makeSuccess"
})
......
......@@ -2,39 +2,52 @@
<view class="pub-page">
<view class="banners">
<swiper class="swiper" circular autoplay @change="changeSwiper">
<swiper-item>
<view class="swiper-item uni-bg-red">
<image src="../../static/images/goods1.png" class="banner-img" mode=""></image>
</view>
</swiper-item>
<swiper-item>
<template v-if="content.imgUrls">
<swiper-item v-for="(item,index) in content.imgUrls" :key="index">
<view class="swiper-item uni-bg-red">
<image :src="item" class="banner-img" mode=""></image>
</view>
</swiper-item>
</template>
<!-- <swiper-item>
<view class="swiper-item uni-bg-red">
<image src="../../static/images/goods2.png" class="banner-img" mode=""></image>
</view>
</swiper-item>
</swiper-item> -->
</swiper>
<view class="swiper-dots flex center align-center">
<view class="swiper-dots flex center align-center" v-if="content.imgUrls">
<image src="../../static/icons/picture.png" style="width: 32rpx;height: 32rpx;" mode=""></image>
{{1+swiperIndex}} / 2
{{1+swiperIndex}} / {{content.imgUrls.length}}
</view>
</view>
<view class="infos">
<view class="name">韩国进口除皱(单部位)</view>
<view class="name">{{content.name}}</view>
<view class="flex between align-center">
<view class="flex align-center">
<view class="price"><text></text>2980</view>
<view class="price-line">¥5800</view>
<template v-if="projectGoodType == 1">
<view class="price"><text></text>{{content.sellPriceRange}}</view>
<view class="price-line">{{content.marketPriceRange}}</view>
</template>
<template v-if="projectGoodType == 2">
<view class="price"><text></text>{{content.sellPrice}}</view>
<view class="price-line">{{content.marketPrice}}</view>
</template>
</view>
<view class="sell">已售2589</view>
<view class="sell">已售{{content.salesQty}}</view>
</view>
</view>
<view class="detail-title"><text>详情</text></view>
<view class="content">
<image src="../../static/images/goods-detail.png" class="width-fix-img" mode="widthFix"></image>
<rich-text v-if="content.content" :nodes="content.content"></rich-text>
<!-- <image src="../../static/images/goods-detail.png" class="width-fix-img" mode="widthFix"></image> -->
</view>
<view class="detail-title"><text>资质证书</text></view>
<view class="certificate">
<image src="../../static/images/certificate.png" class="width-fix-img" mode="widthFix"></image>
<view class="content">
<template v-if="brandInfo.credentialOssUrl">
<image :src="item" mode="" v-for="(item,index) in brandInfo.credentialOssUrl" :key="index"></image>
</template>
<!-- <image src="../../static/images/certificate.png" class="width-fix-img" mode="widthFix"></image> -->
</view>
<!-- <view class="fixed-btn-box"> -->
<view class="pub-btn fixed-btn" @click="openPopup">立即预约</view>
......@@ -46,15 +59,32 @@
<view class="project-row-item mt-30">
<!-- {{item}} -->
<image src="../../static/images/goods1.png" mode="" class="project-row-item_img"></image>
<image :src="nowSku.skuImg" mode="" class="project-row-item_img"></image>
<view class="project-row-item_info">
<view class="project-row-item_info_price"><text></text>29800.00</view>
<view class="project-row-item_info_sell">已售2589</view>
<view class="project-row-item_info_sell" style="padding-top: 40rpx;">已选:1次 </view>
<view class="project-row-item_info_price"><text></text>{{nowSku.sellPrice}}</view>
<view class="project-row-item_info_sell">已售{{nowSku.outboundQty}}</view>
<view class="project-row-item_info_sell" style="padding-top: 40rpx;">
已选:{{nowSku.goodsAttributeNameVal}} </view>
</view>
</view>
<view class="sku-title">容量</view>
<view class="sku-select" v-for="(item, index) in selectedGoodSku" :key="index">
<view class="sku-title">{{ item.specName }}</view>
<view class="sku-list">
<view class="item " :class="item.value == vitem ? 'active' : ''"
@click="changeSkuItem(index,vitem)" v-for="(vitem, vindex) in item.specValues"
:key="vindex">{{vitem}}
</view>
<!-- <view class="item">1000ml</view> -->
<!-- <a-radio-group v-model:value="item.value" button-style="solid">
<a-radio-button :value="vitem" v-for="(vitem, vindex) in item.specValues" :key="vindex">
{{ vitem }}
</a-radio-button>
</a-radio-group> -->
</view>
</view>
<!-- <view class="sku-title">容量</view>
<view class="sku-list">
<view class="item active">500ml</view>
<view class="item">1000ml</view>
......@@ -63,7 +93,7 @@
<view class="sku-list">
<view class="item">500ml</view>
<view class="item active">1000ml</view>
</view>
</view> -->
<view class="pub-btn" @click="makeOrder">提交预约</view>
</view>
</uni-popup>
......@@ -72,7 +102,66 @@
<script setup lang="ts">
import { ref } from 'vue';
import api from '@/api'
import config from '@/config'
import { onLoad } from '@dcloudio/uni-app'
const projectId = ref<any>('')
const projectGoodType = ref<any>('')
onLoad((options : any) => {
let { id, goodType } = options
if (id && goodType) {
projectId.value = id
projectGoodType.value = goodType
getProjectDetail()
}
})
const content = ref<any>({})
const getProjectDetail = async () => {
let res;
if (projectGoodType.value == 1) {
res = await api.project.goodsInfo({ id: projectId.value })
} else {
res = await api.project.goodsPackageInfo({ id: projectId.value })
}
console.log(res.data);
content.value = {
...res.data,
imgUrls: res.data.imgOssUrl.map((item : any) => {
return `${config.imageView}${item}`
}),
sellPriceRange: res.data.sellPriceRange ? res.data.sellPriceRange.split('~')[0] : '',
marketPriceRange: res.data.marketPriceRange ? res.data.marketPriceRange.split('~')[0] : '',
}
if (content.value.brandId) {
// getBrandInfo()
}
// let
// console.log(res);
// if (res.data) {
// content.value = res.data
// }
}
//品牌信息
const brandInfo = ref<any>({})
const getBrandInfo = async () => {
let res = await api.project.brandInfo({ id: content.value.brandId })
brandInfo.value = {
...res.data,
credentialOssUrl: res.data.credentialOssUrl ? res.data.credentialOssUrl.map((item : any) => {
return `${config.imageView}${item}`
}) : []
}
console.log(brandInfo.value);
}
//轮播图
const swiperIndex = ref(0)
const changeSwiper = (e : any) => {
let current = e.detail.current
......@@ -81,15 +170,122 @@
const popup = ref()
console.log(popup);
//选择规格
const selectedGoodSku = ref<any[]>([]);
const openPopup = () => {
if (projectGoodType.value == 2) {
makeOrder()
return
}
// emit('renew', selectedGoods.value);
// content.value = content.value[0];
let goodSku = [];
if (content.value.skuType == 1) {
//单规格
goodSku = [
{
...content.value.skuList[0],
specName: '规格',
specValues: ['默认规格'],
value: '默认规格',
goodsAttributeNameVal: '默认规格',
outboundQty: content.value.salesQty,
sellPrice: content.value.sellPriceRange,
sellPriceRange: content.value.sellPriceRange,
}
];
} else {
//拆分规格
//所有规格名称
let allSpecName = content.value.skuList[0].goodsAttribute.map((aitem : any) => aitem.specName);
goodSku = allSpecName.map((name : any) => {
let specValues = content.value.skuList.map((item : any) => {
let specValue = item.goodsAttribute.find((aitem : any) => aitem.specName == name);
return specValue.specValue;
});
specValues = Array.from(new Set(specValues));
return {
specName: name,
specValues: specValues,
value: specValues[0]
};
});
}
selectedGoodSku.value = [...goodSku];
console.log(selectedGoodSku.value);
// visibleSku.value = true;
popup.value.open('bottom')
getFindSku()
}
const nowSku = ref<any>({})
const changeSkuItem = (index : any, vitem : any) => {
let copySku = [...selectedGoodSku.value]
copySku[index].value = vitem
selectedGoodSku.value = [...copySku]
getFindSku()
}
const getFindSku = () => {
//搜索规格ID
// selectedGood.value.skuList
// console.log(selectedGoodSku.value);
let findSku = content.value.skuList.find((sku : any) => {
//匹配选择的所有规格在商品规格列表中的符合数
const findList = selectedGoodSku.value.map(({ value, specName }) => {
//匹配specName在属性中对应value
let trueAttr = sku.goodsAttribute.filter((fitem : any) => fitem.specName == specName && fitem.specValue == value);
// console.log(trueAttr.length);
return trueAttr.length;
//匹配到对应值则为1
});
//findList应返回格式[1,0,....(属性数量)] 全为1则匹配成功
console.log(findList);
let trueResult = findList.filter((item : Number) => item);
if (trueResult.length == selectedGoodSku.value.length) {
return true;
} else {
return false;
}
});
let goodsAttributeNameVal
if (content.value.skuType == 1) {
findSku = selectedGoodSku.value[0]
goodsAttributeNameVal = '默认规格'
} else {
goodsAttributeNameVal = findSku.goodsAttribute
.map((item : any) => item.specName + ':' + item.specValue)
.join(',');
}
console.log(findSku);
// return goodsAttributeNameVal == item.goodsAttributeName;
let skuImg = findSku.imgOssUrl || (content.value.imgOssUrl && content.value.imgOssUrl.length ? content.value.imgOssUrl[0] : '')
nowSku.value = {
...findSku,
skuImg: `${config.imageView}${skuImg}`,
goodsAttributeNameVal: goodsAttributeNameVal
}
}
const makeOrder = () => {
uni.navigateTo({
url:"/pages/shop/make"
url: `/pages/shop/make?id=${content.value.id}&goodType=${projectGoodType.value}&skuId=${nowSku.value.id}`
})
// uni.navigateTo({
// url: "/pages/shop/make"
// })
}
</script>
......@@ -196,6 +392,12 @@
}
}
.content {
background-color: #fff;
box-sizing: border-box;
padding: 30rpx;
}
.fixed-btn {
position: fixed;
z-index: 9;
......@@ -233,7 +435,8 @@
background: #FFFFFF;
padding: 46rpx 30rpx;
box-sizing: border-box;
.project-row-item{
.project-row-item {
margin-bottom: 34rpx;
}
}
......
......@@ -10,37 +10,55 @@
<view class="flex align-center">
<text>{{item.name}}</text>
<text>{{item.phone}}</text>
<view class="pub-btn">默认地址</view>
<view class="pub-btn" v-if="item.default">默认地址</view>
</view>
<view class="content">{{item.address}}</view>
</view>
<view class="right">
<image src="../../static/icons/editor.png" style="width: 26rpx;height: 26rpx;" mode=""></image>
<image src="../../static/icons/editor.png" style="width: 26rpx;height: 26rpx;" mode=""
@click="toEdit(index+1)"></image>
<image src="../../static/icons/trash-sm.png" style="width: 20rpx;height: 22rpx;margin-left: 43rpx;"
mode=""></image>
</view>
</view>
</view>
<view class="pub-btn fixed" @click="toEdit">添加地址</view>
<view class="pub-btn fixed" @click="toEdit(-1)">添加地址</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const addressList = ref<any[]>([
{
name: '张德',
phone: '158769843211',
isDefault: true,
address: '约克郡壹号半岛15栋12-6',
id: 1
}
])
import { onLoad, onShow } from '@dcloudio/uni-app';
import { useUserStore } from '@/stores/modules/user'
const userStore = useUserStore()
onShow(() => {
// let address;
// try {
// address = userStore.userInfo.customerVo.address
// } catch (e) {
// address = []
// //TODO handle the exception
// }
// addressList.value = [...address]
getUserInfo()
})
const addressList = ref<any[]>([])
const getUserInfo = async () => {
userStore.updateUsersInfo().then((res : any) => {
// console.log();
addressList.value = [...res.customerVo.address]
// console.log(userInfo.value);
})
}
const toEdit = (index : any) => {
const toEdit = () => {
uni.navigateTo({
url: "/pages/user/addressEdit"
url: `/pages/user/addressEdit?index=${index}`
})
}
</script>
......
<template>
<view class="pub-page">
<view class="pub-form" style="margin-top: 36rpx;">
<view class="pub-form-item bd-bt">
<view class="label">联系人姓名</view>
<input type="text" placeholder="请输入联系人姓名" />
<input type="text" placeholder="请输入联系人姓名" v-model="formData.name" />
</view>
<view class="pub-form-item bd-bt">
<view class="label">联系电话</view>
<input type="text" placeholder="请输入联系人电话" />
<input type="text" placeholder="请输入联系人电话" v-model="formData.phone" />
</view>
<view class="pub-form-item bd-bt">
<view class="label">地区</view>
<view class="pub-form-item_right" style="padding: 20rpx 0;">
<input type="text" placeholder="请选择地区" />
<view class="pub-form-item_right" style="padding: 20rpx 0;" @click="openSelect">
<text style="color: #000;" v-if="formData.regionName">{{formData.regionName}}</text>
<text v-else>请选择</text>
<image src="../../static/icons/right.png" class="pub-form-item_right_icon" mode=""></image>
</view>
</view>
<view class="pub-form-item bd-bt">
<view class="label">详细地址</view>
<input type="text" placeholder="街道,小区,门牌号" />
<input type="text" placeholder="街道,小区,门牌号" v-model="formData.address" />
</view>
</view>
<view class="pub-form" style="margin-top: 36rpx;">
<view class="pub-form-item bd-bt">
<view class="label">设为默认</view>
<switch color="#252525" style="transform:scale(0.7)" />
<switch color="#252525" style="transform:scale(0.7)" :checked="formData.default"
@change="changeDefault" />
</view>
</view>
<view class="pub-btn fixed">确认添加</view>
<view class="pub-btn fixed" @click="confirmAdd">{{editIndex ? '保存' : '确认添加'}}</view>
<piaoyi-cityPicker :column="column" :default-value="formData.region" mask-close-able @confirm="confirm"
@cancel="cancel" :visible="visible" />
</view>
</template>
<script setup lang="ts">
// import cityPicker from '@/uni_modules/piaoyi-cityPicker/components/piaoyi-cityPicker/piaoyi-cityPicker'
// import cityPicker from '@/uni_modules/piaoyi-cityPicker/components/piaoyi-cityPicker/piaoyi-cityPicker'
import api from '@/api'
import { reactive, ref, getCurrentInstance } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { useUserStore } from '@/stores/modules/user'
const userStore = useUserStore()
const proxy = getCurrentInstance()?.proxy;
const visible = ref(false)
const column = ref(3)
// const defaultValue = ref<any>(['河北省', '唐山市', '丰南区'])
// const location = ref('')
const formData = reactive<any>({
name: '',
phone: '',
region: '',
code: '',
regionName: '',
address: '',
default: false
})
const editIndex = ref<any>(undefined)
onLoad((options : any) => {
const { index } = options
if (index && index >= 0) {
editIndex.value = index
let customerVo = userStore.userInfo.customerVo
let addressItem = customerVo.address ? customerVo.address[index - 1] : {}
if (addressItem && addressItem.code) {
for (let key in formData) {
if (addressItem[key]) {
formData[key] = addressItem[key]
}
}
}
}
// const
})
const openSelect = () => {
visible.value = true
}
const confirm = (res : any) => {
const { areaName,
cityName,
code,
name,
provinceName } = res
// console.log(res);
visible.value = false
formData.region = [provinceName, cityName, areaName]
formData.code = code
formData.regionName = name
}
const cancel = () => {
visible.value = false
}
const changeDefault = (e : any) => {
// console.log(e.detail.value);
formData.default = e.detail.value
}
const confirmAdd = () => {
if (!formData.name) {
proxy?.$modal.toast('请输入姓名')
return
}
if (!formData.phone) {
proxy?.$modal.toast('请输入联系电话')
return
}
if (!formData.address) {
proxy?.$modal.toast('请输入地址')
return
}
if (!formData.code) {
proxy?.$modal.toast('请选择地区')
return
}
let customerVo = userStore.userInfo.customerVo
let oldAddress = [...customerVo.address]
if (formData.default) {
oldAddress = oldAddress.map((item : any) => {
return {
...item,
default: false
}
})
}
if (editIndex.value) {
oldAddress[editIndex.value - 1] = { ...formData }
} else {
oldAddress = [...oldAddress, formData]
}
let datas = {
id: customerVo.id,
address: oldAddress
}
api.user.editAddress(datas).then((res : any) => {
console.log(res);
proxy?.$modal.toastSuccess('操作成功')
setTimeout(() => {
uni.navigateBack()
}, 1000)
})
}
</script>
<style lang="less" scoped></style>
\ No newline at end of file
<template>
<view class="pub-page">
<view class="card">
<template v-if="!cardInfo.id">
<view class="flex column align-center center">
<template v-if="!cardInfo.cardNum">
<view class="flex column align-center center" @click="toEdit">
<image src="../../static/icons/add.png" style="width: 64rpx;height: 64rpx;" mode=""></image>
<text>添加银行卡</text>
</view>
</template>
<template v-else>
<view class="flex card-info align-center between">
<view class="flex card-info align-center between" @click="toEdit">
<view class="left">
<view class="name">工商银行</view>
<view class="card-number">**** **** **** 1687</view>
<view class="name">{{cardInfo.openBank}}</view>
<view class="card-number">{{cardInfo.cardNumHide}}</view>
</view>
<image src="../../static/icons/editor.png" style="width: 26rpx;height: 26rpx;" mode=""></image>
</view>
</template>
</view>
<view class="pub-btn fixed" @click="toEdit">添加地址</view>
<!-- <view class="pub-btn fixed" @click="toEdit">添加地址</view> -->
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { useUserStore } from '@/stores/modules/user'
const userStore = useUserStore()
onShow(() => {
// userInfo.value = userStore.$state
// console.log(userInfo.value);
getUserInfo()
})
const cardInfo = ref<any>({})
const getUserInfo = async () => {
userStore.updateUsersInfo().then((res : any) => {
// console.log();
if (res.customerVo.bankCards?.length) {
let bankCard = res.customerVo.bankCards[0]
try {
bankCard.cardNumHide = bankCard.cardNum.split('').map((item : any, index : number) => {
if (index <= (bankCard.cardNum.length - 5)) {
return '*'
} else {
return item
}
}).join('')
} catch (e) {
bankCard.cardNumHide = bankCard.cardNum
//TODO handle the exception
}
cardInfo.value = bankCard
// cardInfo.value.cardNumHide
}
console.log(cardInfo.value);
})
}
const cardInfo = ref<any>({ id: 1 })
const toEdit = () => {
......
......@@ -3,41 +3,87 @@
<view class="pub-form" style="margin-top: 36rpx;">
<view class="pub-form-item bd-bt">
<view class="label">姓名</view>
<input type="text" placeholder="请输入姓名,与证件保持一致" />
<input type="text" placeholder="请输入姓名,与证件保持一致" v-model="formData.name" />
</view>
<view class="pub-form-item bd-bt">
<view class="label">身份证号</view>
<input type="text" placeholder="请输入您的身份证号,与证件保持一致" />
<input type="text" placeholder="请输入您的身份证号,与证件保持一致" v-model="formData.idCard" />
</view>
</view>
<view class="pub-form" style="margin-top: 36rpx;">
<view class="pub-form-item bd-bt">
<view class="label">银行卡号</view>
<input type="text" placeholder="请输入银行卡号" />
<input type="text" placeholder="请输入银行卡号" v-model="formData.cardNum" />
</view>
<view class="pub-form-item bd-bt">
<view class="label">开户行</view>
<input type="text" placeholder="请输入开户行" />
<input type="text" placeholder="请输入开户行" v-model="formData.openBank" />
</view>
<view class="pub-form-item bd-bt">
<view class="label">开户支行</view>
<input type="text" placeholder="请输入开户支行" />
<input type="text" placeholder="请输入开户支行" v-model="formData.openBranchBank" />
</view>
<view class="pub-form-item bd-bt">
<view class="label">银行预留号码</view>
<input type="text" placeholder="请输入银行预留号码" />
<input type="text" placeholder="请输入银行预留号码" v-model="formData.phone" />
</view>
</view>
<view class="pub-btn fixed">确认添加</view>
<view class="pub-btn fixed" @click="submit">{{isEdit ? '保存' : '确认添加'}}</view>
</view>
</template>
<script setup lang="ts">
import api from '@/api'
import { reactive, ref, getCurrentInstance } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { useUserStore } from '@/stores/modules/user'
const userStore = useUserStore()
const proxy = getCurrentInstance()?.proxy;
const isEdit = ref(false)
const formData = reactive<any>({
name: '',
idCard: '',
cardNum: '',
openBank: '',
openBranchBank: '',
phone: '',
})
onLoad(() => {
let customerVo = userStore.userInfo.customerVo
let bankCard = customerVo.bankCards ? customerVo.bankCards[0] : {}
console.log(userStore, userStore.userInfo, customerVo.bankCards);
if (bankCard && bankCard.cardNum) {
// customerVo.bankCards
for (let key in formData) {
if (bankCard[key]) {
formData[key] = bankCard[key]
}
}
isEdit.value = true
}
})
const submit = () => {
let customerVo = userStore.userInfo.customerVo
let datas = {
id: customerVo.id,
bankCards: [formData]
}
api.user.editBankCards(datas).then((res : any) => {
console.log(res);
proxy?.$modal.toastSuccess('操作成功')
setTimeout(() => {
uni.navigateBack()
}, 1000)
})
}
</script>
<style lang="less" scoped></style>
\ No newline at end of file
......@@ -11,11 +11,11 @@
<view class="user-info flex between align-center">
<template v-if="userInfo">
<view class="left">
<view class="user-name">Advens</view>
<view class="user-name">{{userInfo.name}}</view>
<view class="integral">
<image src="../../static/images/integral.png" mode="" style="width: 24rpx;height: 24rpx;">
</image>
<text>2500</text>
<text>{{userInfo.account}}</text>
</view>
</view>
......@@ -28,7 +28,7 @@
</navigator>
</template>
<template v-else>
<view class="login-text">
<view class="login-text" @click="tologin">
登录/注册
</view>
</template>
......@@ -96,9 +96,34 @@
</template>
<script setup lang="ts">
import api from '@/api'
import { ref } from 'vue';
const userInfo = ref('1')
import { onShow } from '@dcloudio/uni-app';
import { useUserStore } from '@/stores/modules/user'
const userStore = useUserStore()
// console.log(userStore);
const userInfo = ref<any>({})
onShow(() => {
// userInfo.value = userStore.$state
// console.log(userInfo.value);
getUserInfo()
})
const getUserInfo = async () => {
userStore.updateUsersInfo().then((res : any) => {
// console.log();
userInfo.value = { ...res.customerVo }
console.log(userInfo.value);
})
}
const tologin = () => {
uni.navigateTo({
url: "/pages/login/index"
})
}
const editUserInfo = () => {
uni.navigateTo({
url: '/pages/user/userInfo'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment