合并代码
This commit is contained in:
parent
53bc5bb6df
commit
d56e2e6666
|
@ -132,6 +132,18 @@ const shop = {
|
|||
* 获取收货地址
|
||||
* @param {Object} param
|
||||
*/
|
||||
getDefaultAddress(param) {
|
||||
return util.request({
|
||||
url: `/shopify/appAddress/getDefaultOne`,
|
||||
method: 'GET',
|
||||
query: param.query,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取默认收货地址
|
||||
* @param {Object} param
|
||||
*/
|
||||
getAddressList(param) {
|
||||
return util.request({
|
||||
url: `/shopify/appAddress/getList`,
|
||||
|
@ -195,7 +207,7 @@ const shop = {
|
|||
* 查看收藏记录
|
||||
* @param {Object} param
|
||||
*/
|
||||
collect(param) {
|
||||
getCollectList(param) {
|
||||
return util.request({
|
||||
url: `/shopify/collect`,
|
||||
method: 'GET',
|
||||
|
@ -266,6 +278,32 @@ const shop = {
|
|||
load: true,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取发布的商品列表
|
||||
* @param {Object} param
|
||||
*/
|
||||
addOrder(param) {
|
||||
return util.request({
|
||||
url: `/shopify/appOrder/addOrder`,
|
||||
data: param.data,
|
||||
method: 'POST',
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
* @param {Object} param
|
||||
*/
|
||||
getOrderDetail(param) {
|
||||
return util.request({
|
||||
url: `/shopify/appOrder/getOne`,
|
||||
query: param.query,
|
||||
method: 'GET',
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
export default shop
|
|
@ -421,9 +421,21 @@ const video = {
|
|||
*/
|
||||
myLikeVideoList(param) {
|
||||
return util.request({
|
||||
url: `/home/myLikeVideoList`,
|
||||
url: `/video/homepage/myLike`,
|
||||
query: param.query,
|
||||
method: 'POST',
|
||||
method: 'GET',
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 查看历史记录
|
||||
* @param {Object} param
|
||||
*/
|
||||
getHistoryVideoList(param) {
|
||||
return util.request({
|
||||
url: `/video/homepage/history`,
|
||||
query: param.query,
|
||||
method: 'GET',
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -433,8 +445,8 @@ const video = {
|
|||
*/
|
||||
getVideoById(param) {
|
||||
return util.request({
|
||||
url: `/homecommon/getVideoById`,
|
||||
query: param.query,
|
||||
url: `/video/video/getParticulars`,
|
||||
data: param.data,
|
||||
method: 'POST',
|
||||
})
|
||||
},
|
||||
|
@ -482,6 +494,17 @@ const video = {
|
|||
method: 'POST',
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 查看作品
|
||||
*/
|
||||
myWorks(param) {
|
||||
return util.request({
|
||||
url: `/video/homepage/myWorks`,
|
||||
query: param.query,
|
||||
method: 'GET',
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
export default video
|
|
@ -5,9 +5,8 @@ const config = {
|
|||
host: 'http://localhost:5173',
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
// host: 'http://1641c8e0.r22.cpolar.top',
|
||||
host: 'http://192.168.0.189:8080',
|
||||
// host: 'http://192.168.0.102:8080',
|
||||
host: 'https://539c1514.r24.cpolar.top',
|
||||
// host: 'http://gfjds5.natappfree.cc',
|
||||
// #endif
|
||||
// 上传文件二级路径
|
||||
uploadFilePath: "/homecommon/file/preview?fileName=",
|
||||
|
|
|
@ -212,7 +212,7 @@ const util = {
|
|||
responseType: params.responseType || 'text',
|
||||
// 请求成功返回
|
||||
success: res => {
|
||||
// console.log('request success', url, res, params.data ? params.data : '')
|
||||
console.log('request success', url, res, params.data ? params.data : '')
|
||||
// 关闭加载效果
|
||||
if (params.load) {
|
||||
uni.hideLoading()
|
||||
|
|
|
@ -63,10 +63,15 @@
|
|||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
// 是否统计 0不是 1是
|
||||
statistic: {
|
||||
type: [String, Number],
|
||||
default: 0,
|
||||
},
|
||||
})
|
||||
//
|
||||
const emit = defineEmits(['showTime', 'showComment', 'showCollect', 'showFastCollect', 'showShareFirend', 'onPlay',
|
||||
'onPause', 'like', 'detailMenu', 'onEnd', 'longtap'
|
||||
'onPause', 'like', 'detailMenu', 'onEnd', 'longtap','dataCenter'
|
||||
])
|
||||
|
||||
// 视频上下文对象
|
||||
|
@ -455,6 +460,11 @@
|
|||
videoCtx.value.playbackRate(2)
|
||||
}
|
||||
|
||||
//
|
||||
function handleData() {
|
||||
emit('dataCenter', props.item)
|
||||
}
|
||||
|
||||
//
|
||||
defineExpose({
|
||||
play,
|
||||
|
@ -511,6 +521,15 @@
|
|||
|
||||
<!-- 操作台 -->
|
||||
<view class="operate f1">
|
||||
<!-- 留言 -->
|
||||
<view class="item fmid" @click="handleData">
|
||||
<view class="col">
|
||||
<image class="wh50" src="/static/statistic.png" mode="aspectFit" />
|
||||
</view>
|
||||
|
||||
<view class="txt mt20"></view>
|
||||
</view>
|
||||
|
||||
<!-- 用户头像 -->
|
||||
<navigator :url="util.setUrl('/pages/index/videoHome',{userId:item.userId})" class="item pr mb10">
|
||||
<view class="col">
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
<scroll-view scroll-y="true" class="scroll f1" :show-scrollbar="false">
|
||||
<view class="list">
|
||||
|
||||
<navigator url="/pages/index/wallet" class="item df fdr aic mtb15 ptb40 plr30 bfff br20" hover-class="none">
|
||||
<navigator url="/pages/index/wallet/wallet" class="item df fdr aic mtb15 ptb40 plr30 bfff br20" hover-class="none">
|
||||
<image class="wh80 mr25" src="/static/leftMenu1.png" mode="aspectFit" />
|
||||
<text class="text f1 c333 f28">我的钱包</text>
|
||||
</navigator>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
if (props.mode == 'list') {
|
||||
uni.navigateTo({
|
||||
url: util.setUrl('/pages/index/videoDetail', {
|
||||
videoId: item.videoId,
|
||||
videoId: item.id,
|
||||
isMine: props.isMine,
|
||||
})
|
||||
})
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
<script setup>
|
||||
/**
|
||||
* 我的作品组件
|
||||
*/
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue'
|
||||
import {
|
||||
useStore
|
||||
} from 'vuex'
|
||||
// 工具库
|
||||
import util from '@/common/js/util';
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
// 视频菜单
|
||||
import videoMenu from '@/components/index/videoMenu.vue';
|
||||
|
||||
// 列表数据
|
||||
const list = reactive({
|
||||
data: [],
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
total: 0,
|
||||
})
|
||||
// 仓库
|
||||
const store = useStore()
|
||||
// 用户信息
|
||||
const userinfo = computed(() => store.state.userinfo)
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
// 刷新列表
|
||||
function refreshList() {
|
||||
list.pageNum = 1
|
||||
list.total = 0
|
||||
getList()
|
||||
}
|
||||
|
||||
// 获取更多列表
|
||||
function getMoreList() {
|
||||
if (list.data.length >= list.total) return
|
||||
list.pageNum++
|
||||
getList()
|
||||
}
|
||||
|
||||
// 获取列表
|
||||
function getList() {
|
||||
//
|
||||
api.video.getHistoryVideoList({
|
||||
query: {
|
||||
userId: userinfo.value.id,
|
||||
pageSize: list.pageSize,
|
||||
pageNum: list.pageNum,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
if (list.pageNum == 1) list.data.length = []
|
||||
list.data.push(...rs.rows.map(item => {
|
||||
item.format_videoUrl = util.format_url(item.videoUrl, 'video')
|
||||
item.format_imageUrl = util.format_url(item.imageUrl, 'img')
|
||||
return item
|
||||
}))
|
||||
list.total = rs.total
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击我的作品
|
||||
* @param {Object} item
|
||||
*/
|
||||
function handleItem(item) {
|
||||
console.log(item)
|
||||
}
|
||||
|
||||
//
|
||||
defineExpose({
|
||||
getList,
|
||||
getMoreList,
|
||||
refreshList,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="">
|
||||
<videoMenu :list="list.data" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
//
|
||||
</style>
|
|
@ -21,17 +21,14 @@
|
|||
// 列表数据
|
||||
const list = reactive({
|
||||
data: [],
|
||||
pageSize: 10,
|
||||
pageSize: 18,
|
||||
pageNum: 1,
|
||||
total: 0,
|
||||
})
|
||||
// 仓库
|
||||
const store = useStore()
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
let result = store.state.userinfo
|
||||
return result
|
||||
})
|
||||
const userinfo = computed(() => store.state.userinfo)
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
@ -53,11 +50,10 @@
|
|||
|
||||
// 获取列表
|
||||
function getList() {
|
||||
return
|
||||
//
|
||||
api.video.myLikeVideoList({
|
||||
query: {
|
||||
userId: userinfo.value.userId,
|
||||
userId: userinfo.value.id,
|
||||
pageSize: list.pageSize,
|
||||
pageNum: list.pageNum,
|
||||
}
|
||||
|
|
|
@ -5,8 +5,13 @@
|
|||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue'
|
||||
//
|
||||
import {
|
||||
useStore,
|
||||
} from 'vuex'
|
||||
// 工具库
|
||||
import util from '@/common/js/util';
|
||||
// api
|
||||
|
@ -17,10 +22,13 @@
|
|||
// 列表数据
|
||||
const list = reactive({
|
||||
data: [],
|
||||
pageSize: 10,
|
||||
pageSize: 9,
|
||||
pageNum: 1,
|
||||
total: 0,
|
||||
})
|
||||
const store = useStore()
|
||||
// 用户信息
|
||||
const userinfo = computed(() => store.state.userinfo)
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
@ -48,10 +56,10 @@
|
|||
|
||||
// 获取列表
|
||||
function getList() {
|
||||
return
|
||||
//
|
||||
api.video.myVideoList({
|
||||
api.video.myWorks({
|
||||
query: {
|
||||
userId: userinfo.value.id,
|
||||
pageSize: list.pageSize,
|
||||
pageNum: list.pageNum,
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
onMounted(() => {
|
||||
// 开启监听
|
||||
addListener()
|
||||
addListener()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
|
@ -65,16 +65,16 @@ addListener()
|
|||
<view class="info f1">
|
||||
<!-- 收获地址 -->
|
||||
<view class="location f30">
|
||||
<text class="c333">收货地址收货地址收货地址收货地址收货地址收货地址收货地址</text>
|
||||
<text class="c333">{{address.province}}{{address.city}}{{address.country}}{{address.detail}}</text>
|
||||
</view>
|
||||
<!-- 姓名电话 -->
|
||||
<view class="name">
|
||||
<text class="c999 f26">张三 123456789</text>
|
||||
<text class="c999 f26">{{address.name}} {{address.mobile}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 选择地址 -->
|
||||
<view v-if="shopEdit" class="btn ti warmHollow plr20 ml20" @click="link('/pages/mine/delivery-address/index')">
|
||||
<view v-if="shopEdit" class="btn ti warmHollow plr20 ml20" @click="link('/pages/mine/address/index')">
|
||||
<text class="cFF9B27">选择地址</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -46,13 +46,6 @@
|
|||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/shop/continue-pay/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "继续付款",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/shop/store/index",
|
||||
"style": {
|
||||
|
@ -145,7 +138,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/mine/delivery-address/index",
|
||||
"path": "pages/mine/address/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "收货地址",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
|
@ -713,6 +706,14 @@
|
|||
"navigationBarTitleText" : "支付顺序",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/shop/commodity/payment",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "继续付款",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<view class="charts" v-if="1">
|
||||
<view class="charts" v-if="0">
|
||||
<qiun-data-charts type="column" :opts="opts" :chartData="chartData" :ontouch="true" />
|
||||
</view>
|
||||
<view class="mtb30 fmid" v-else>
|
||||
|
|
|
@ -59,8 +59,8 @@
|
|||
// 获取视频详情
|
||||
function getVideoDetail() {
|
||||
api.video.getVideoById({
|
||||
query: {
|
||||
videoId: videoId.value,
|
||||
data: {
|
||||
id: videoId.value,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
|
@ -201,12 +201,22 @@
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转数据中心
|
||||
* @param {Object} detail
|
||||
*/
|
||||
function handleDataCenter(detail) {
|
||||
//
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="page f1">
|
||||
<!-- -->
|
||||
<indexVideo ref="indexVideo" :item="detail" :tabIndex="0" :isMine="isMine" :index="0" :current="0" mode="detail" @showComment="handleShowCommentAlt" @showCollect="handleShowCollectAlt" @showShareFirend="handleShowShareFirend" @like="videoLike" @detailMenu="detailMenu" />
|
||||
<indexVideo ref="indexVideo" :statistic="1" :item="detail" :tabIndex="0" :isMine="isMine" :index="0" :current="0" mode="detail"
|
||||
@showComment="handleShowCommentAlt" @showCollect="handleShowCollectAlt"
|
||||
@showShareFirend="handleShowShareFirend" @like="videoLike" @detailMenu="detailMenu" @dataCenter="handleDataCenter" />
|
||||
|
||||
<!-- 评论弹窗 -->
|
||||
<commentAlt ref="commentRef" />
|
||||
|
|
|
@ -58,9 +58,10 @@
|
|||
|
||||
// 获取视频详情
|
||||
function getVideoDetail() {
|
||||
console.log('videoId.value', videoId.value)
|
||||
api.video.getVideoById({
|
||||
query: {
|
||||
videoId: videoId.value,
|
||||
data: {
|
||||
id: videoId.value,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
import product from '@/components/mine/product.vue';
|
||||
// 我的喜欢
|
||||
import like from '@/components/mine/like.vue';
|
||||
// 我的历史
|
||||
import history from '@/components/mine/history.vue';
|
||||
|
||||
// 是否显示顶部遮罩
|
||||
const headerShow = ref(false)
|
||||
|
@ -49,37 +51,40 @@
|
|||
const tabList = reactive([{
|
||||
name: '作品',
|
||||
ref: 'productRef',
|
||||
load: false,
|
||||
},
|
||||
{
|
||||
name: '喜欢',
|
||||
ref: 'likeRef',
|
||||
load: false,
|
||||
},
|
||||
{
|
||||
name: '收藏',
|
||||
ref: 'collectRef',
|
||||
load: false,
|
||||
},
|
||||
{
|
||||
name: '历史浏览',
|
||||
ref: 'historyRef',
|
||||
load: false,
|
||||
},
|
||||
{
|
||||
name: '投流历史',
|
||||
load: false,
|
||||
}
|
||||
])
|
||||
// 分类列表下标
|
||||
const tabIndex = ref(2)
|
||||
const tabIndex = ref('')
|
||||
// tab当前项
|
||||
const tabCurrent = computed(() => {
|
||||
let result = tabList[tabIndex.value]
|
||||
return result
|
||||
})
|
||||
|
||||
const tabCurrent = computed(() => tabList[tabIndex.value])
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
let result = store.state.userinfo || {}
|
||||
return result
|
||||
})
|
||||
const userinfo = computed(() => store.state.userinfo || {})
|
||||
|
||||
onLoad(() => {
|
||||
// 初始化
|
||||
handleTabIndex(0)
|
||||
|
||||
// 开启监听
|
||||
uni.$on('focusUser', () => {
|
||||
// 更新用户信息
|
||||
util.getUserinfo()
|
||||
|
@ -127,6 +132,7 @@
|
|||
function handleTabIndex(index) {
|
||||
if (tabIndex.value === index) return
|
||||
tabIndex.value = index
|
||||
tabList[tabIndex.value].load = true
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -274,7 +280,7 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<!-- -->
|
||||
<!-- 作品 -->
|
||||
<view class="product mt30">
|
||||
<view class="tab">
|
||||
<scroll-view scroll-x="true" class="scroll">
|
||||
|
@ -286,18 +292,18 @@
|
|||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 作品 -->
|
||||
<view v-show="tabIndex === 0">
|
||||
<!-- 我发布的作品 -->
|
||||
<view v-show="tabIndex === 0" v-if="tabList[0].load">
|
||||
<product ref="productRef" />
|
||||
</view>
|
||||
|
||||
<!-- 喜欢 -->
|
||||
<view class="like" v-show="tabIndex === 1">
|
||||
<!-- 我的喜欢 -->
|
||||
<view class="like" v-show="tabIndex === 1" v-if="tabList[1].load">
|
||||
<like ref="likeRef" />
|
||||
</view>
|
||||
|
||||
<!-- 收藏 -->
|
||||
<view class="collect" v-show="tabIndex === 2">
|
||||
<!-- 我的收藏 -->
|
||||
<view class="collect" v-show="tabIndex === 2" v-if="tabList[2].load">
|
||||
<!-- 添加收藏按钮 -->
|
||||
<view class="btn bd1s fmid mtb20 mlr20 c333 f32" @click="$refs.collectAddRef.open()">
|
||||
<uni-icons type="plus" size="30rpx" />
|
||||
|
@ -307,6 +313,10 @@
|
|||
<!-- 收藏列表按钮 -->
|
||||
<collectList ref="collectRef" @handleItem="handleCollectsItem" />
|
||||
</view>
|
||||
|
||||
<view class="history" v-show="tabIndex === 3" v-if="tabList[3].load">
|
||||
<history ref="historyRef" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@
|
|||
<image class="avatar wh130 cir" :src="userinfo.userPortrait" mode="aspectFill" />
|
||||
<view class="info f1 mlr30">
|
||||
<view class="nickname f34">{{ userinfo.userNickname }}</view>
|
||||
<view class="address df aic mt15 f28 c666" @click="link('/pages/mine/delivery-address/index')">
|
||||
<image class="wh30" src="@/static/mine-dingwei.png" mode="aspectFill" />
|
||||
<view class="address df aic mt15 f28 c666" @click="link('/pages/mine/address/index')">
|
||||
<image class="wh30 mr10" src="/static/mine-dingwei.png" mode="aspectFill" />
|
||||
<text>收货地址</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -241,6 +241,11 @@
|
|||
<!-- #endif -->
|
||||
</view>
|
||||
|
||||
<view class="fmid fdc mtb50">
|
||||
<image class="wh150 br20" src="/static/logo.png" mode="aspectFill" />
|
||||
<view class="mt20 c333 f26">塔罗科技网络(山东)有限公司旗下品牌---九亿</view>
|
||||
</view>
|
||||
|
||||
<!-- 切换账号 退出登录 -->
|
||||
<view class="mtb30 c999">
|
||||
<view @click="logOff" class="btn">退出登录</view>
|
||||
|
|
|
@ -5,9 +5,31 @@
|
|||
ref
|
||||
} from 'vue';
|
||||
import apex from '@/components/header/apex'
|
||||
|
||||
import {
|
||||
onReachBottom,
|
||||
onPullDownRefresh,
|
||||
onShow,
|
||||
onLoad,
|
||||
onReady,
|
||||
} from '@dcloudio/uni-app';
|
||||
//
|
||||
import api from '@/api/index.js';
|
||||
// util
|
||||
import util from '@/common/js/util';
|
||||
//
|
||||
const setting = ref(false)
|
||||
|
||||
onLoad(() => {
|
||||
// 获取列表
|
||||
getList()
|
||||
})
|
||||
|
||||
// 获取列表
|
||||
function getList() {
|
||||
api.shop.getCollectList({}).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
reactive,
|
||||
getCurrentInstance,
|
||||
computed,
|
||||
defineEmits
|
||||
defineEmits,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
//
|
||||
import util from '@/common/js/util.js'
|
||||
|
@ -35,50 +36,34 @@
|
|||
})
|
||||
// 地址
|
||||
const address = reactive({})
|
||||
// 用户信息
|
||||
const userinfo = computed(() => store.state.userinfo)
|
||||
//
|
||||
const emit = defineEmits(['update'])
|
||||
|
||||
// 规格
|
||||
const spec = reactive([{
|
||||
name: '款型',
|
||||
option: [{
|
||||
name: '普通款',
|
||||
},
|
||||
{
|
||||
name: '升级款',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '卡通形象',
|
||||
option: [{
|
||||
name: '熊',
|
||||
},
|
||||
{
|
||||
name: '狗',
|
||||
},
|
||||
{
|
||||
name: '猫',
|
||||
},
|
||||
{
|
||||
name: '河豚',
|
||||
},
|
||||
],
|
||||
}
|
||||
])
|
||||
// 已选择的规格下标
|
||||
const spaceIndex = reactive([])
|
||||
const spaceIndex = ref(0)
|
||||
// 数量
|
||||
const payNum = ref(1)
|
||||
// 当前选择的规格
|
||||
const currentSpec = computed(() => {
|
||||
let spec = props.detail.specs || []
|
||||
return spec[spaceIndex.value] || {}
|
||||
})
|
||||
// 用户信息
|
||||
const userinfo = computed(() => store.state.userinfo)
|
||||
// 应付总价
|
||||
const total = computed(() => {
|
||||
let price = parseFloat(props.detail.price) * 100
|
||||
let result = parseInt(price * payNum.value) / 100
|
||||
return result
|
||||
})
|
||||
//
|
||||
const menuFn = {
|
||||
// 店铺
|
||||
store() {
|
||||
util.checkLink('pages/shop/store/index')
|
||||
link('/pages/shop/store/index')
|
||||
},
|
||||
// 客服
|
||||
customerService() {
|
||||
util.checkLink('pages/news/question-answer/index')
|
||||
link('/pages/news/question-answer/index')
|
||||
},
|
||||
// 收藏
|
||||
heibianStar() {
|
||||
|
@ -86,6 +71,25 @@
|
|||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 获取默认收货地址
|
||||
getDefaultAddress()
|
||||
})
|
||||
|
||||
// 获取默认收货地址
|
||||
function getDefaultAddress() {
|
||||
api.shop.getDefaultAddress({}).then(res => {
|
||||
if (res.code === 200) {
|
||||
if (res.data) Object.assign(address, {}, res.data)
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: res.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转
|
||||
* @param {Object} url 跳转路径
|
||||
|
@ -99,10 +103,9 @@
|
|||
/**
|
||||
* 选择规格
|
||||
* @param {Object} index 选择规格下标
|
||||
* @param {Object} secIndex
|
||||
*/
|
||||
function handleSpec(index, secIndex) {
|
||||
spaceIndex.splice(index, 1, secIndex)
|
||||
function handleSpec(index) {
|
||||
if (spaceIndex.value !== index) spaceIndex.value = index
|
||||
}
|
||||
|
||||
// 切换收藏
|
||||
|
@ -133,6 +136,48 @@
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 立即下单
|
||||
function handlePay() {
|
||||
// 验证必填项
|
||||
if (!address.id) {
|
||||
util.alert('请选择收货地址')
|
||||
return
|
||||
}
|
||||
|
||||
// 产生待付款订单
|
||||
api.shop.addOrder({
|
||||
data: [{
|
||||
// 地址id
|
||||
addressId: address.id,
|
||||
// 产品id
|
||||
productId: props.detail.id,
|
||||
// 规格id
|
||||
attrValueId: currentSpec.value.id,
|
||||
// 数量
|
||||
payNum: payNum.value,
|
||||
// 0-普通订单,1-视频号订单
|
||||
orderType: 0,
|
||||
// 分享人id
|
||||
// shareId: userinfo.id,
|
||||
}],
|
||||
}).then(rs => {
|
||||
if (rs.code === 200) {
|
||||
if (rs.data && rs.data[0])
|
||||
// 跳转
|
||||
uni.navigateTo({
|
||||
url: util.setUrl('/pages/shop/commodity/payment', {
|
||||
orderId: rs.data[0].orderId,
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -173,53 +218,53 @@
|
|||
<uni-popup type="bottom" ref="popup">
|
||||
<view class="buy popBot plr20 bfff">
|
||||
<view class="address mtb40">
|
||||
<JyCommodityAddress :address="address"></JyCommodityAddress>
|
||||
<template v-if="address.id">
|
||||
<JyCommodityAddress :address="address" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="fmid c999 f28" @click="link('/pages/mine/address/index')">
|
||||
<view>暂无默认地址</view>
|
||||
<uni-icons type="right" color="#999" size="30rpx" />
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<!-- 商品图 价格 明细 数量 -->
|
||||
<view class="jy-card-commodity-content df mtb40">
|
||||
<!-- 商品图 -->
|
||||
<image class="wh200 br10"
|
||||
src="https://img30.360buyimg.com/popWareDetail/jfs/t1/124291/22/31317/138753/6449f30dF90683c84/4fee5d1a337f7b90.jpg.avif"
|
||||
mode="aspectFill" />
|
||||
<image class="wh200 br10" :src="currentSpec.image" mode="aspectFill" />
|
||||
<!-- 价格 明细 数量 -->
|
||||
<view class="info f1 df fdc jcsb ml30">
|
||||
<!-- 价格 -->
|
||||
<view class="content-info-price">
|
||||
<text class="cFF9B27 f28">应付</text>
|
||||
<text class="cFF9B27 f28">单价</text>
|
||||
<text class="cFF9B27 f24">¥</text>
|
||||
<text class="cFF9B27 f50">89</text>
|
||||
<text class="cFF9B27 f50">{{detail.price}}</text>
|
||||
</view>
|
||||
<!-- 已选 -->
|
||||
<view class="content-info-num">
|
||||
<text class="f26 c333">已选 规格一 / 规格二</text>
|
||||
<text class="f26 c333">已选: {{currentSpec.sku}}</text>
|
||||
</view>
|
||||
<!-- 计数器 -->
|
||||
<view class="w200">
|
||||
<uni-number-box :value="1" :step="1" />
|
||||
<uni-number-box v-model="payNum" :step="1" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 规格 -->
|
||||
<view class="spec">
|
||||
<view class="item mtb20" v-for="(item, index) in spec">
|
||||
<!-- 标题 -->
|
||||
<view class="title f32">{{item.name}}</view>
|
||||
<!-- 选项 -->
|
||||
<view class="selection df">
|
||||
<!-- disabled 销量为零不能选 -->
|
||||
<view class="option mtb20 mr20" :class="{'active': spaceIndex[index] === secIndex}"
|
||||
v-for="(secItem,secIndex) in item.option" :key="secIndex"
|
||||
@click="handleSpec(index,secIndex)">
|
||||
<text class="txt">{{secItem.name}}</text>
|
||||
</view>
|
||||
<view class="option mtb20 mr20" :class="{'active': spaceIndex === index}"
|
||||
v-for="(item,index) in detail.specs" :key="index" @click="handleSpec(index)">
|
||||
<text class="txt">{{item.sku}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btn lg primary mtb30" @click="link('/pages/shop/continue-pay/index')">
|
||||
<text class="cfff">立即下单 ¥89</text>
|
||||
<view class="btn lg primary mtb30" @click="handlePay">
|
||||
<text class="cfff">立即下单 ¥{{total}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
@ -238,9 +283,6 @@
|
|||
// 规格
|
||||
.spec {
|
||||
|
||||
// 可选菜单
|
||||
.selection {
|
||||
|
||||
// 选项
|
||||
.option {
|
||||
padding: 5rpx 15rpx;
|
||||
|
@ -275,5 +317,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,21 +1,29 @@
|
|||
<script setup>
|
||||
import {
|
||||
ref
|
||||
ref,
|
||||
} from 'vue'
|
||||
import {
|
||||
onReachBottom,
|
||||
onPullDownRefresh,
|
||||
onShow,
|
||||
onLoad,
|
||||
onReady,
|
||||
} from '@dcloudio/uni-app';
|
||||
// 地址
|
||||
import JyCommodityAddress from '@/components/public/jy-commodity-address'
|
||||
// 店铺信息
|
||||
import JyShopInformation from '@/components/public/jy-shop-information'
|
||||
// 商品信息
|
||||
import JyCommodityInformation from '@/components/public/jy-commodity-information'
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
// util
|
||||
import util from '@/common/js/util';
|
||||
|
||||
import {
|
||||
bottomSafeAreaHeight
|
||||
} from '@/components/public/Mixins.js'
|
||||
|
||||
// 订单id
|
||||
const orderId = ref('')
|
||||
// 支付方式
|
||||
const paytype = ref('1')
|
||||
|
||||
// 支付方式列表
|
||||
// 要么先用积分 要么用余额 不够的话 全部的积分和剩下的余额 在个人中心增加一个优先支付的选项
|
||||
const paytypeList = [{
|
||||
|
@ -35,6 +43,30 @@
|
|||
}
|
||||
]
|
||||
|
||||
onLoad((option) => {
|
||||
if (option.orderId) orderId.value = option.orderId
|
||||
// 获取订单详情
|
||||
getDetail()
|
||||
})
|
||||
|
||||
// 获取订单详情
|
||||
function getDetail() {
|
||||
api.shop.getOrderDetail({
|
||||
query: {
|
||||
id: orderId.value
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
//
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 选择支付方式
|
||||
function handlePayment(ev) {
|
||||
//
|
|
@ -374,4 +374,3 @@ likeType
|
|||
7 商家和用户进行交流
|
||||
|
||||
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 473 B |
|
@ -3,6 +3,10 @@ import {
|
|||
} from 'vite';
|
||||
import uni from '@dcloudio/vite-plugin-uni';
|
||||
|
||||
//
|
||||
// let target = 'http://101.35.80.139:8080'
|
||||
let target = 'http://2hs9aj.natappfree.cc'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
server: {
|
||||
|
@ -10,39 +14,27 @@ export default defineConfig({
|
|||
port: 5173,
|
||||
proxy: {
|
||||
"/system": {
|
||||
target: "http://192.168.0.102:8080",
|
||||
// target: "http://192.168.0.189:8080",
|
||||
// target: "http://192.168.0.129:8080",
|
||||
target,
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/shopify": {
|
||||
target: "http://192.168.0.189:8080",
|
||||
// target: "http://192.168.0.102:8080",
|
||||
// target: "http://192.168.0.129:8080",
|
||||
target,
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/user": {
|
||||
target: "http://192.168.0.189:8080",
|
||||
// target: "http://192.168.0.102:8080",
|
||||
// target: "http://192.168.0.129:8080",
|
||||
target,
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/coreplay": {
|
||||
target: "http://192.168.0.189:8080",
|
||||
// target: "http://192.168.0.102:8080",
|
||||
// target: "http://192.168.0.129:8080",
|
||||
target,
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/file": {
|
||||
target: "http://192.168.0.189:8080",
|
||||
// target: "http://192.168.0.102:8080",
|
||||
// target: "http://192.168.0.129:8080",
|
||||
target,
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/video": {
|
||||
target: "http://192.168.0.189:8080",
|
||||
// target: "http://192.168.0.102:8080",
|
||||
// target: "http://192.168.0.129:8080",
|
||||
target,
|
||||
changeOrigin: true,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue