[fix]页面样式修改

main
huyuanxiang 2 years ago
parent 24115b68c3
commit 8eb059753f

@ -3,14 +3,22 @@ import { getConfig, setConfig, getCart, getToken ,getCartNumber } from "./utils/
import myconfig from "./utils/config";
import request from "./utils/request";
import {setTabBarBadge } from'./utils/util.js'
let colors = getConfig();
let nowColor = ''
if(colors){
nowColor = colors.color
}
uni.$ajax = request; //
export default {
onLaunch: function () {
//#ifdef H5
// var head = document.head || document.getElementsByTagName('head')[0];
// let meta = document.createElement('meta')
// meta.setAttribute('http-equiv', 'Content-Security-Policy')
// meta.setAttribute('content', 'upgrade-insecure-requests')
// console.log(meta)
// head.appendChild(meta)
// #endif
// #ifdef MP-WEIXIN
uni.getSetting({
success: res => {
@ -42,33 +50,28 @@ export default {
}
}
}); //
let config = getConfig();
if (config && config.color !== '') {
let config = getConfig()
if (!config) {
config = myconfig.themeList[5]
setConfig(config)
}
// 使
uni.setTabBarStyle({
selectedColor: config.color
});
let tabList = config.tabList;
if (config.tabList) {
for (var i = 0; i < tabList.length; i++) {
let img = tabList[i];
uni.setTabBarItem({
//tabBar
index: i,
selectedIconPath: img
});
}
}
} else {
// 使
let fristColor = {};
fristColor.color = '#39b54a';
fristColor.name = "green";
setConfig(fristColor);
uni.setTabBarStyle({
selectedColor: '#39b54a'
});
}
uni.setTabBarStyle({
selectedColor: config.color
});
config.tabList.forEach((v, index) => {
uni.setTabBarItem({
//tabBar
index,
selectedIconPath: v
});
})
if (!getToken()) {
uni.navigateTo({
url: '/pages/login/index1'
})
return
}
/**
* 模拟获取购物车的数量 getCart
*/
@ -84,12 +87,135 @@ export default {
userInfo: null,
statusHeight: '20', //
toBar: '44', //
newColor: nowColor || '#39b54a', //
config: myconfig.themeList //
newColor: myconfig.themeList[5].color, //
config: myconfig.themeList,//
themeObj: myconfig.themeList[5]
},
methods: {}
};
</script>
<style>
<style lang="scss">
@import "./app.css";
.uni-system-preview-image {
z-index: 9999;
}
$default: #fa436a;
$red: #e54d42;
$orange: #f37b1d;
$yellow: #fbbd08;
$olive: #8dc63f;
$green: #39b54a;
$cyan: #1cbbb4;
$blue: #0081ff;
$purple: #6739b6;
$mauve: #9c26b0;
$pink: #e03997;
$brown: #a5673f;
$grey: #8799a3;
$black: #333333;
@mixin scss6($color){
&.category {
.nav .cu-item.cur {
color: $color;
&::after {
background-color: $color;
}
}
}
&.goodsDetails {
.operation .btns .addcart {
border-color: $color;
color: $color;
}
.operation .btns .dingjin {
background-color: $color;
}
.sku_tag .tag_s.active {
color: $color;
background: white;
border-color: $color;
}
}
&.order {
.bottom_btn .btns,
.morelist .title .quan {
background: $color;
}
.weizhi_icon .icon-dizhi,
.goods_title .price .t1,
.morelist .right_title,
.bottom_btn .moneys .price {
color: $color;
}
}
&.myaddress, &.editaddress {
.weizhi_icon .icon-dizhi,
.moren .icon-moren {
color: $color;
}
.save .btn {
background: $color;
}
}
}
.theme {
&.default {
@include scss6($default)
}
&.red {
@include scss6($red)
}
&.orange {
@include scss6($orange)
}
&.yellow {
@include scss6($yellow)
}
&.olive {
@include scss6($olive)
}
&.green {
@include scss6($green)
}
&.cyan {
@include scss6($cyan)
}
&.blue {
@include scss6($blue)
}
&.purple {
@include scss6($purple)
}
&.mauve {
@include scss6($mauve)
}
&.pink {
@include scss6($pink)
}
&.brown {
@include scss6($brown)
}
&.grey {
@include scss6($grey)
}
&.black {
@include scss6($black)
}
}
</style>

@ -1,8 +1,10 @@
import request from "@/utils/request";
import { getToken, removeToken, removeUserInfo } from "@/utils/auth";
export const getGoodsList = (params) => request('/erp/goods/list', params, 'get')
export const getGoodsById = (params) => request('/erp/goods/queryById', params, 'get')
export const getAddrList = (params) => request('/erp/addrManager/list', params, 'get')
@ -13,11 +15,69 @@ export const editOrder = (params) => request('/erp/order/edit', params, 'post')
export const addAddr = (params) => request('/erp/addrManager/add', params, 'post')
export const editAddr = (params) => request('/erp/addrManager/edit', params, 'post')
export const delAddr = (params) => request('/erp/addrManager/delete?id='+params, {} , 'delete')
export const getCode = (params) => request('/sys/randomImage/' + params, {}, 'get')
export const login = (params) => request('/sys/login', params, 'POST')
export const getStatusList = (params) => request('/erp/order/queryState', params, 'get')
export const getStatusList = (params) => request('/erp/order/queryState', params, 'get')
export const addCommit = (params) => request('/erp/bbs/add', params, 'post')
export const getCommits = (params) => request('/erp/bbs/list', params, 'get')
export const getCommit = (params) => request('/erp/bbs/queryById', params, 'get')
export const addCart = (params) => request('/erp/shoppingCart/add', params, 'post')
export const delCart = (params) => request('/erp/shoppingCart/delete?id='+params, {} , 'delete')
export const delCarts = (params) => request('/erp/shoppingCart/deleteBatch?ids='+params, {} , 'delete')
export const getCarts = (params) => request('/erp/shoppingCart/list', params , 'get')
export const uploadFile = (filePath) => {
return new Promise((resolve, reject) => {
uni.showLoading({
mask: true
})
uni.uploadFile({
url: 'http://47.100.35.222:8080/jeecg-boot/sys/common/upload', //仅为示例,非真实的接口地址
filePath,
name: 'file',
header: {
'X-Access-Token': getToken(),
},
formData: {
biz: 'temp',
},
success: (res) => {
uni.hideLoading()
if (res.statusCode && res.statusCode === 401) {
removeToken()
removeUserInfo()
uni.showToast({
title: '登录超时',
icon: 'none'
})
setTimeout(() => {
uni.redirectTo({
url: '/pages/login/index1?status=' +1
})
}, 500)
return
}
const data = JSON.parse(res.data)
resolve(data.message)
},
fail(e) {
uni.hideLoading()
reject(e)
console.log('e', e)
}
});
})
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,3 @@
export default {
imgUrl: 'http://47.100.35.222:8080/jeecg-boot/sys/common/static/'
}

@ -2,12 +2,13 @@ import Vue from 'vue';
import App from './App';
import nodata from "./pages/commponent/public/nodata";
import request from 'utils/request.js' //引入异步请求函数
import {toast} from './utils/util'
import json from './json' //测试用数据
Vue.prototype.request = request.request //挂载到全局
Vue.prototype.$toast = toast //挂载到全局
Vue.component("nodata", nodata);
Vue.config.productionTip = false;
Vue.mixin({

@ -0,0 +1,6 @@
{
"dependencies": {
},
"devDependencies": {
}
}

@ -295,6 +295,8 @@
"style": {
"navigationBarTitleText": "搜索",
"navigationBarBackgroundColor": "#F8F8F8"
// "enablePullDownRefresh":true
}
},
{
@ -307,12 +309,12 @@
{
"path": "pages/views/user/allFootprint",
"style": {
"navigationBarTitleText": "我的足迹",
"navigationStyle": "custom",
"app-plus": {
"titleNView": false,
"bounce": "none"
}
"navigationBarTitleText": "浏览历史"
// "navigationStyle": "custom",
// "app-plus": {
// "titleNView": false,
// "bounce": "none"
// }
}
}
],

@ -24,11 +24,15 @@
</view> -->
</view>
<view class="goumai margin-top-xs flex justify-between align-center">
<view class="g_left price">
<view class="g_left price" v-if="hasToken">
<text v-if="item.price" class="text1 text-bold text-sm"> {{item.price}} </text>
<text style="color: #222">/{{ item.unit}}</text>
<!-- <text v-if="item.skuItem.dashPrice" class="text2 text-xs"> {{item.skuItem.dashPrice.text}}</text> -->
</view>
<view class="g_left price" v-else>
<text class="text1 text-bold text-sm">客服询价 </text>
</view>
<!-- <view class="g_right" @tap="addCart(item)">
<image src="/static/images/new/jiagou.png" style=" width: 28px;height: 28px;" mode="aspectFill"></image>
@ -59,12 +63,17 @@
</view>
<view class="place">
</view>
<view class="no-more" v-if="loading">
{{ hasMore ? '' : list.length === 0 ? '无相关数据...' : '已经到底了...' }}
</view>
</view>
</template>
<script>
import { setTabBarBadge } from '@/utils/util.js'
import {getCart, setCart ,resetCart, getCartNumber,setGoodsData, setGoodsHistory, setCartDetails, setGoodsDetails,getToken} from '@/utils/auth.js'
import {getCart, setCart ,resetCart, getCartNumber,setGoodsData,
setCartDetails,
setGoodsDetails,getToken} from '@/utils/auth.js'
export default {
data() {
return {
@ -72,65 +81,36 @@
number: 1,
imgList:[],
selectSku:{},
sku: [{
sku_id: 1,
skuname: '规格',
child: [{
tagname: '测试规格1',
id: 2011,
imgs: '',
money: ''
},
{
tagname: '测试规格2',
id: 2012,
imgs: '',
money: ''
}
]
}],
skuArr: [{
goods_sku_arr: ['2011'],
goods_sku_text: '醇黑巧克力【20枚】',
img: 'http://img10.360buyimg.com/n1/jfs/t1/86401/35/12206/357766/5e43b59cE5a7aa4dd/0753be765166c195.jpg',
money: '175.78',
stock: 345
},
{
goods_sku_arr: ['2012'],
goods_sku_text: '草莓味【8枚】',
img: 'http://img11.360buyimg.com/n1/jfs/t1/74434/3/6892/331750/5d512febE54e891c4/0096ad20c3c20d23.jpg',
money: '35.90',
stock: 255
},
]
sku: [],
skuArr: []
},
list: [],
list: []
}
},
props:{
propsList:{
type:Array
},
loading: {
type: Boolean,
default: false
},
hasMore: {
type: Boolean,
default: false
},
hasToken: {
type: Boolean,
default: true
}
},
created() {
// if(this.propsList){
// this.list = this.propsList
// }
},
watch: {
propsList: function(newVal,oldVal){
console.log('newVal', newVal)
this.list = newVal; //newValchartData
}
},
methods: {
jumpDetails(item) {
setGoodsHistory(item)
setGoodsDetails(item)
uni.navigateTo({
url: '/pages/views/goods/goodsDetails?id=' + item.id
});
@ -233,7 +213,9 @@
.goodList {
position: relative;
padding: 20rpx;
padding-bottom: 40upx;
column-count: 2;
/*分为两列 用于瀑布流*/
column-gap: 20rpx;
@ -241,6 +223,16 @@
background: #F8F8F8;
overflow: hidden;
}
.no-more {
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
// padding: 40upx;
font-size: 28upx;
color: #000;
padding: 10upx;
}
.tag1 {
font-size: 20rpx;
border: 1px solid #FF5560;

@ -0,0 +1,392 @@
<template>
<view>
<p class="youhui" style="border-bottom: none;" v-if="showTitle">
<text class="text1">图片/视频</text>
<text class="text3" v-if="showColseBtn">({{filesNum}})</text>
</p>
<view class="img_box" >
<view class="img_list" v-for="(item, index) in myFileList" :key="index">
<block v-if="item.type == 'img'">
<image :src="item.url" mode="" class="imgs"
@click="previewImg(item.url)">
</image>
<image z-index="9999" v-if="showColseBtn"
src="/static/images/search/close.png" mode="" class="close"
@tap="delFiles(index)">
</image>
</block>
<block v-if="item.type == 'video'">
<video :src="item.url" :poster="item.poster" :controls="false"
:show-center-play-btn="false" :show-play-btn="false"
:enable-progress-gesture="false">
<cover-view class="covers"></cover-view>
<cover-image v-if="!showVideo"
class="imgs" src="/static/images/goods/bofang.png" mode=""
@click="onshowVideo(item.url)">
</cover-image>
<cover-image v-if="!showVideo && showColseBtn"
src="/static/images/search/close.png" mode=""
class="video_close"
@tap="delFiles(index)">
</cover-image>
</video>
</block>
</view>
<view class="addImg"v-if="myFileList.length < filesNum && showColseBtn"
@tap="onChoose">
<image src="/static/images/shexiang.png" mode=""></image>
<p>添加图片/视频</p>
</view>
</view>
<view class="mask" v-if="showVideo"
@touchmove.stop.prevent="ondefault"
@click="hideShow">
<view class="close">
<image src="/static/images/goods/close.png"></image>
</view>
</view>
<view class="previewvideo" v-if="showVideo">
<view class="videos">
<video class="nowvideos" id="nowVideo" :src="video" :autoplay="showVideo"
:show-center-play-btn="true" :show-mute-btn="true" :show-fullscreen-btn="false"></video>
</view>
</view>
<!-- 用来承载H5预览视频的 -->
<view style="position: absolute;top: -999upx;left: -999upx;">
<video ref="newVideo" id="newVideo" :src="video"
:autoplay="showVideo"
:show-center-play-btn="false" :show-mute-btn="true" :show-fullscreen-btn="false">
</video>
</view>
</view>
</template>
<script>
import { uploadFile } from '@/api';
import CONFIG from '@/config'
export default {
created() {
this.platform = uni.getSystemInfoSync().platform //ios
this.newVideo = uni.createVideoContext('newVideo');
},
data() {
return {
isH5: false,
platform: '',
video: '',
showVideo: false,
newVideo: null,
myFileList: []
}
},
props: {
value: {
type: Array,
default: () => ([])
},
showColseBtn: {
type: Boolean,
default: true
},
filesNum: {
type: Number,
default: 5
},
showTitle: {
type: Boolean,
default: true
},
data: {
type: Array,
default: () => ([])
},
},
watch: {
value: {
handler(newV) {
this.myFileList = [...newV]
},
deep: true,
immediate: true
}
},
methods: {
previewImg(url){ //
let arr = []
arr[0] = url
uni.previewImage({
urls:arr
})
},
onshowVideo(video) { //
this.video = video
// #ifndef H5
this.showVideo = true
this.newVideo && this.newVideo.play()
// #endif
// #ifdef H5
// h5
if(this.platform == 'android'){ //ios
this.isH5 = true
this.newVideo.play()
}else{
this.showVideo = true
}
// #endif
},
hideShow(){ //
this.showVideo = false
},
delFiles(index) {
this.myFileList.splice(index, 1);
},
onChoose(){
uni.showActionSheet({
title:"选择上传类型",
itemList: ['图片','视频'],
success: (res) => {
if(res.tapIndex == 0){
this.chooseImages()
} else {
this.chooseVideo()
}
}
})
},
chooseImages() { //
const that = this;
if(this.myFileList.length >= this.filesNum){ //3
this.$toast(`$最多上传{this.filesNum}个`)
return
}
uni.chooseImage({
//
count: 1, //
sizeType: ['original', 'compressed'], //
success: function(res) {
const tempFilePaths = res.tempFilePaths;
uploadFile(tempFilePaths[0]).then(img => {
that.myFileList.push({
type: 'img',
url: CONFIG.imgUrl + img,
_url: img
})
that.$emit('input', that.myFileList)
})
}
});
},
chooseVideo(){ //
const that = this;
if(this.myFileList.length >= this.filesNum){ //3
this.$toast(`$最多上传{this.filesNum}个`)
return
}
uni.chooseVideo({
count: 1,
sourceType: ['camera', 'album'],
success: function (res) {
const tempFilePaths = res.tempFilePath;
uploadFile(tempFilePaths).then(img => {
that.myFileList.push({
type: 'video',
url: CONFIG.imgUrl + img,
_url: img
})
that.$emit('input', that.myFileList)
})
}
});
},
ondefault(){
//
}
}
}
</script>
<style lang="scss" scoped>
.youhui {
height: 40upx;
line-height: 40upx;
padding: 20upx 30upx;
border-bottom: 1upx solid #f2f2f2;
box-sizing: content-box;
.text1 {
font-size: 28upx;
color: #333333;
}
.text2 {
float: right;
color: #999999;
font-size: 28upx;
margin-right: 5upx;
margin-top: 2upx;
}
.text3 {
font-size: 24upx;
color: #999999;
margin-left: 10upx;
}
image {
float: right;
width: 12upx;
height: 22upx;
margin-top: 12upx;
margin-left: 10upx;
}
}
.img_box {
overflow: hidden;
padding: 20upx 30upx;
.addImg {
width: 184upx;
height: 184upx;
background: #f2f2f2;
// background-color: pink;
border-radius: 20upx;
overflow: hidden;
transition: all 0.3s;
image {
width: 51upx;
height: 42upx;
display: block;
margin: 0 auto;
margin-top: 45upx;
}
p {
font-size: 24upx;
font-family: Microsoft YaHei;
font-weight: 400;
color: rgba(255,94,102,1);
text-align: center;
margin-top: 20upx;
}
&:active {
transform: scaleX(0.96);
}
}
}
.img_list {
width: 184upx;
height: 184upx;
float: left;
margin-right: 20upx;
position: relative;
overflow: hidden;
margin-bottom: 20upx;
image,video {
width: 100%;
height: 100%;
display: block;
}
video{
position: relative;
border-radius: 5upx;
overflow: hidden;
overflow: visible!important;
.covers{ //
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 9990;
}
.imgs{
width: 72upx;
height: 72upx;
position: absolute;
top: 50%;
left: 50%;
z-index: 9999;
transform: translate(-50% ,-50%);
}
.video_close{
width: 40upx;
height: 40upx;
position: absolute;
display: block;
top: -6upx;
left: -6upx;
border-radius: 50%;
z-index: 9999;
}
}
.close {
width: 40upx;
height: 40upx;
position: absolute;
box-sizing: border-box;
top: -6upx;
left: -6upx;
border-radius: 50%;
}
}
/* 预览视频弹窗 */
.mask {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, .8);
z-index: 999;
}
.previewvideo {
width: 100vw;
height: 100vw;
position: fixed;
top: 50%;
left: 0;
transform: translateY(-50%);
background-color: #000;
z-index: 1000;
opacity: 1;
}
.close {
display: flex;
align-content: center;
align-items: flex-end;
position: absolute;
top: 100upx;
right: 20upx;
z-index: 900;
image {
width: 50upx;
height: 50upx;
display: block;
justify-content: center;
margin-left: 30upx;
margin-bottom: 20upx;
border-radius: 50%;
padding: 10upx;
background-color: rgba(0, 0, 0, 0.2);
}
}
.videos {
height: 100vw;
width: 100vw;
z-index: 10;
position: relative;
video {
width: 100%;
height: 100%;
}
}
.nowvideos {
width: 100%;
height: 100%;
margin: 0 auto;
}
</style>

@ -65,6 +65,7 @@ export default {
};
</script>
<style lang="scss" scoped>
.status_bar{
width: 100vw;
overflow: hidden;

@ -20,11 +20,6 @@ export default {
props: {},
methods: {
jumpSearch() {
uni.showToast({
icon: 'none',
title: '功能开发中,敬请期待'
})
return
uni.navigateTo({
url: '/pages/views/home/search'
});
@ -36,6 +31,7 @@ export default {
<style lang="scss" scoped>
.search{
z-index: 900;
}
.input-box {
width: 100%;

@ -4,21 +4,21 @@
<view class="mask" @touchmove.stop.prevent="moveHandle" v-if="showModal" @tap="onhide"></view>
<view @touchmove.stop.prevent="moveHandle" :class="'sku ' + (showModal==true ? 'shows':'')" :style="{bottom: showModal == true ? bottoms+'upx': ''}">
<view class="sku_top">
<image :src="currentSku.img" class="top_img"></image>
<image :src="goods.url" class="top_img"></image>
<view class="sku_title">
{{nowList.title}}
{{goods.goodsName}}
</view>
<view class="moneys">
<!-- 这里的价格是选择完规格后计算的价格 -->
{{(Number(currentSku.money) * number).toFixed(2)}}
{{(Number(goods.price) * number).toFixed(2)}}
</view>
<view class="kucun">
<!-- 这里的价格是选择完规格后计算的库存 -->
库存: {{currentSku.stock}}
库存: {{goods.stock || stock }}
</view>
</view>
<block v-if="nowList.sku && nowList.sku.length > 0">
<view v-for="(item, index) in nowList.sku"
<block v-if="goods._skus.length > 0">
<view v-for="(item, index) in goods._skus"
:key="index"
class="sku_list">
<view class="sku_name">
@ -40,9 +40,9 @@
<view class="number">
<view class="n_left">购买数量</view>
<view class="n_right">
<text class="jian" @tap="onreduce"></text>
<text class="jian" @tap="onChangeNum('reduce')"></text>
<input :value="number" disabled type="number" maxlength="2" class="inputs"></input>
<text class="jia" @tap="onadd"></text>
<text class="jia" @tap="onChangeNum('add')"></text>
</view>
</view>
<view class="btn_box">
@ -56,6 +56,7 @@
<script>
import { setTabBarBadge } from'@/utils/util.js'
import {getCart, setCart ,resetCart, setGoodsData,getCartNumber, getToken} from '@/utils/auth.js'
import { addCart } from '@/api';
export default {
data() {
return {
@ -67,6 +68,8 @@ export default {
issku: false ,//
update: true,
nowList:{},
stock: 500
};
},
components: {},
@ -78,7 +81,7 @@ export default {
type: Boolean,
default: false
},
skuList: {
goods: {
type: Object
},
bottoms:{
@ -88,19 +91,15 @@ export default {
},
computed:{
skuArr() {
return this.skuList.skuArr;
return this.goods.skuArr;
}
},
watch:{
skuList(value){//
value.sku.forEach((v, index) => {
goods(newVal){//
newVal._skus.forEach((v, index) => {
this.$set(this.currentArr, index, v.child[0].id)
})
this.issku = false //
this.number = 1 //
this.skulength = 0 //
this.currentSku = value
this.nowList = value
}
},
methods: {
@ -225,26 +224,20 @@ export default {
this.$emit('onhide')
},
onadd() {
//
let data = this.number + 1;
this.setData({
number: data
});
},
onreduce() {
//
if (this.number <= 1) {
return;
} else {
let data = this.number - 1;
this.setData({
number: data
});
}
onChangeNum(type = 'reduce') {
if (type === 'add') {
if (this.number >= this.stock) {
return
}
this.number += 1
} else {
if (this.number <= 1) {
return;
}
this.number -= 1
}
},
onsubmit(value) {
//
if(!getToken()){
@ -254,71 +247,77 @@ export default {
return
}
//
if(Object.keys(this.currentArr).length != this.nowList.sku.length){ //
if(Object.keys(this.currentArr).length != this.goods._skus.length){ //
uni.showToast({
title: '请选择规格',
icon: 'none'
});
}else {
//
var data = this.nowList
if(this.issku == true){ //
data.selectSku = this.currentSku
}
const selectedSku = []
Object.keys(this.currentArr).forEach(key => {
const item = this.currentArr[key]
if (item) {
const sku = this.nowList.sku[key].child[item -1 ]
selectedSku.push(sku)
}
})
data._selectedSku = selectedSku
data.number = this.number
if(value == 'add'){ //
let colCart = getCart();
if(colCart.length){
const hasItem = colCart.some(v => v.goods_id === data.goods_id)
if (!hasItem) {
colCart.push(data)
} else {
for(let y = 0;y < colCart.length; y++){
const item = colCart[y]
if (data.goods_id === item.goods_id) {
item.number ++
item._selectedSku = selectedSku
break
}
}
}
} else {
colCart = [data]
}
resetCart(colCart)
//
uni.showToast({
title: '加入购物车成功 !',
icon: 'none'
});
/**
* 模拟获取购物车的数量 getCart
*/
let cartNum = getCartNumber()
setTabBarBadge(cartNum)
}else{ //
let goods = []
goods.push(data)
setGoodsData(goods) //
uni.navigateTo({ //
url:'/pages/views/order/confirmOrder'
})
}
setTimeout(() => {
this.$emit('onhide')
}, 800);
}
return
}
// addCart
const cartParams = {
"goodsId": 0,
"goodsName": "",
"goodsNo": 0,
"url": "",
"userId": "",
specs: ''
}
const data = this.goods
const selectedSku = []
Object.keys(this.currentArr).forEach(key => {
const item = this.currentArr[key]
if (item) {
const sku = this.goods._skus[key].child[item -1 ]
sku.number = sku.number ? sku.number + this.number : this.number
selectedSku.push(sku)
}
})
data._selectedSku = selectedSku
data.number = this.number
if(value == 'add'){ //
let colCart = getCart();
if(colCart.length){
const hasItem = colCart.some(v => v.id === data.id)
if (!hasItem) {
colCart.push(data)
} else {
for(let y = 0;y < colCart.length; y++){
const item = colCart[y]
if (data.id === item.id) {
item.number += this.number
item._selectedSku = selectedSku
break
}
}
}
} else {
colCart = [data]
}
resetCart(colCart)
//
uni.showToast({
title: '加入购物车成功 !',
icon: 'none'
});
/**
* 模拟获取购物车的数量 getCart
*/
let cartNum = getCartNumber()
setTabBarBadge(cartNum)
}else{ //
let goods = []
goods.push(data)
setGoodsData(goods) //
uni.navigateTo({ //
url:'/pages/views/order/confirmOrder'
})
}
setTimeout(() => {
this.$emit('onhide')
}, 800);
},
//
getAllSku(){

@ -39,7 +39,7 @@
methods: {
jumpNext(item){
uni.navigateTo({
url:'/pages/views/goods/goodsDetails'
url:'/pages/views/goods/goodsDetails?id=' + item.id
})
}
}

@ -59,6 +59,7 @@ export default {
tel:'',
smscode:'123456',
codeImg: '',
status: '',
currentTime: new Date().getTime()
};
},
@ -66,9 +67,11 @@ export default {
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.status = options.status
// #ifdef MP-WEIXIN
this.wxlogin(); //code
// #endif
},
onShow: function () {
if (getToken()) {
@ -176,7 +179,14 @@ export default {
uni.showToast({
title:'登陆成功'
})
uni.navigateBack(-1)
const paths = getCurrentPages()
uni.reLaunch({
url: '/pages/views/tabBar/category'
})
// if (this.status) {
// }
// uni.navigateBack(-1)
} else {
uni.hideLoading()
uni.showToast({
@ -421,20 +431,21 @@ export default {
}
.t-login .t-c1 {
position: absolute;
right: 22rpx;
top: 140rpx;
right: 10rpx;
top: 148rpx;
width: 160rpx;
height: 80rpx;
background: #5677fc;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
}
.t-login .t-c1 image {
left: 0;
top: 0;
width: 100%;
height: 100%;
border-radius: 50upx;
}
.t-login .t-d {
text-align: center;

@ -234,7 +234,7 @@
}
.details {
padding: 20upx 4%;
padding: 20upx 20upx 100upx 20upx;
margin-top: 20upx;
border-top: 10upx solid #ddd;
margin-bottom: 120upx;
@ -247,7 +247,6 @@
.details_content {
margin-top: 30upx;
margin-bottom: 50upx;
}
.operation {
@ -514,12 +513,15 @@
align-content: flex-start;
justify-content: space-between;
margin-top: 20upx;
width: 29vw;
height: 29vw;
border-radius: 10upx;
&::after {
content: '';
max-width: 29vw;
min-width: 29vw;
}
image {
img,image {
max-width: 29vw;
min-width: 29vw;
height: 29vw;

@ -1,11 +1,11 @@
<template>
<view class="goodsDetails">
<view class="goodsDetails" :class="['theme', themeObj.name]">
<!-- 顶部自定义导航栏 -->
<view class="top_nav">
<navBar textcolor="#000" :showLeft="true" :showTitle="false"></navBar>
</view>
<!-- 轮播图 -->
<swipers :goodsData="goodsData" @setShowVideo="setShowVideo"></swipers>
<swipers :goodsData="goods" @setShowVideo="setShowVideo"></swipers>
<!-- 占位 -->
<!-- #ifndef MP -->
<view class="place" :style="'top:-' + toBar"></view>
@ -13,15 +13,19 @@
<!-- 商品信息 -->
<view class="goods_info">
<view class="goods_name">
{{goodsData.title}}
{{goods.goodsName}}
</view>
<view class="text-gray text-sm padding-top-xs">
{{goodsData.skuSubTitle}}
{{goods.category}}
</view>
<view class="goods_price">
<text class="money text-lg">¥{{goodsData.money}}</text>
<view class="goods_price" v-if="hasToken">
<text class="money text-lg">¥{{goods.price}}</text>
<text>/{{ goods.unit }}</text>
<text class="h_money">{{goodsData.hmoney}}</text>
<text class="h_money">{{goodsData.hprice}}</text>
</view>
<view class="goods_price" v-else>
<text class="money text-lg">客服询价</text>
</view>
<!-- <view class="shoucang">
<view class="sc_icons" @tap="setisColl">
@ -99,45 +103,41 @@
</view> -->
</view>
<!-- 商品评价 -->
<!-- view class="evaluate">
<view class="evaluate">
<p class="eva_title">
商品评价<text>(10)</text>
<text class="seeAll" @click="seeAll"></text>
{{ commits.length > 0 ? '商品评价' : '暂无评价' }}<text>({{ commits.length }})</text>
<text class="seeAll" @click="seeAll" v-if="commits.length > 0"></text>
</p>
<view class="evaluate_box">
<view class="pingjia">
<view v-if="goodsEva.length !== 0">
<view class="pingjia_box" v-for="(row, index) in goodsEva" :key="index">
<view v-if="commits.length > 0">
<view class="pingjia_box" v-for="(row, index) in commits" :key="index">
<view class="box_top">
<image :src="row.headimg" mode="" class="head"></image>
<image :src="row.headimg || defaultUserImg" mode="" class="head"></image>
<view class="right">
<p class="name">{{ row.nickname }}</p>
<p class="name">{{ row.userName }}</p>
<p class="p2">
<text class="text1">{{ row.create_time }}</text>
<text class="text2">{{ row.goods_name }}</text>
<text class="text1">{{ row.createTime }}</text>
<text class="text2">{{ row.goodsName }}</text>
</p>
<p class="p3">
<image src="/static/images/home/stars.png" v-for="s in row.score" :key="s" mode=""></image>
<block v-if="row.score !== 5">
<image src="/static/images/home/star-no.png" v-for="(s,h) in (5-row.score)" :key="h" mode=""></image>
</block>
<image src="/static/images/home/stars.png" v-for="s in +row.qualityScore" :key="s" mode=""></image>
<image src="/static/images/home/star-no.png" v-for="(s,h) in (5-row.qualityScore)"
:key="h" mode=""></image>
</p>
</view>
</view>
<view class="tag_box" v-if="row.tags.length !== 0">
<view class="tag_box" v-if="row.tags">
<view class="tags" v-for="(s,x) in row.tags" :key="x">{{s}}</view>
</view>
<view class="ping_neirong">{{ row.comment }}</view>
<view class="ping_img" v-if="row.images.length !== 0">
<image :src="s" mode="" v-for="(s,x) in row.images" :key="x" @click="preview(row.images, x)"></image>
</view>
<view class="ping_neirong">{{ row.content }}</view>
<fileList v-model="row.fileList" :show-title="false" :show-colse-btn="false"></fileList>
<view class="huifu" v-if="row.reply && row.reply !== ''">{{ row.reply }}</view>
</view>
</view>
</view>
</view>
</view> -->
</view>
<!-- 商品详情 -->
<view class="details">
<view class="details_title">
@ -155,17 +155,18 @@
<view class="cart" @tap="toCart">
<text class="iconfont icon-gouwuche1"></text>
</view>
<view class="btns">
<view class="addcart" :style="'border-color:' + colors + ';color:' + colors" @tap="openSku">
<view class="btns" v-if="goods.ifSale !== 0">
<view class="addcart"
@tap="openSku">
加入购物车
</view>
<view class="dingjin" :style="'background:' + colors" @tap="openSku">
<view class="dingjin" @tap="openSku">
</view>
</view>
</view>
<!-- 规格弹出层 -->
<sku :skuList="nowList" :showModal="showModal" :colors="colors" bottoms="0" @onhide="onhide"></sku>
<sku :goods="goods" :showModal="showModal" :colors="colors" bottoms="0" @onhide="onhide"></sku>
<!-- 选择优惠券弹出层 -->
<view class="mask" catchtouchmove="preventTouchMove" v-if="couponshow == true" @tap="hidecoupon"></view>
<view class="coupon" :style="'bottom:' + (couponshow == true ? '0px':'')">
@ -193,22 +194,26 @@
</view>
</uni-popup>
<!-- 预览视频弹窗 -->
<view class="mask" v-if="showVideo == true" @touchmove.stop.prevent="ondefault" @click="hideShow">
<view class="mask" v-if="showVideo == true" @touchmove.stop.prevent="ondefault"
@click="hideShow">
<view class="close">
<image src="/static/images/goods/close.png"></image>
</view>
</view>
<view class="previewvideo" v-if="showVideo == true">
<view class="videos">
<video class="nowvideos" id="nowVideo" v-if="showVideo == true" :src="goodsData.videos" :autoplay="showVideo"
<video class="nowvideos" id="nowVideo" v-if="showVideo == true"
:src="goods.videos" :autoplay="showVideo"
:show-center-play-btn="true" :show-mute-btn="true" :show-fullscreen-btn="false"></video>
</view>
</view>
<!-- 用来承载H5预览视频的 -->
<view style="position: absolute;top: -999upx;left: -999upx;">
<video ref="newVideo" id="newVideo" :src="goodsData.videos"
<video ref="newVideo" id="newVideo"
:src="goods.videos"
:autoplay="showVideo"
:show-center-play-btn="false" :show-mute-btn="true" :show-fullscreen-btn="false" @fullscreenchange="hideShow"></video>
:show-center-play-btn="false" :show-mute-btn="true" :show-fullscreen-btn="false"
@fullscreenchange="hideShow"></video>
</view>
<loading v-if="isShow == true"></loading>
</view>
@ -223,16 +228,17 @@
import loading from "../../commponent/public/loading";
import poster from '../../commponent/goods/poster.vue'
import swipers from './swiper/swiper.vue'
import fileList from '@/pages/commponent/public/fileList.vue'
import {getGoodsDetails,getlocation} from '@/utils/auth.js'
import {getGoodsDetails,getlocation, getToken, setGoodsHistory} from '@/utils/auth.js'
import { getGoodsById, addCart, getCommits } from '@/api';
import CONFIG from '@/config'
import { getFileList } from'@/utils/util.js'
export default {
data() {
return {
good:{}, //
colors: '',
shows: false,
statusBarHeight: app.globalData.statusHeight + 'px',
@ -243,7 +249,6 @@
latitude: '',
longitude: '',
nowList: {},
goods: {},
goodsData: {
title: '',
skuSubTitle:'',
@ -269,7 +274,7 @@
isshowVideo: true,
voice: false,
showVideo: false,
isShow: true,
isShow: false,
couponList: [ //
{
money: 100,
@ -336,7 +341,19 @@
tags: []
}
],
scrollShow: false
scrollShow: false,
defaultUserImg: '/static/images/face.jpg',
commits: [],
goodsId: 0,
goods: {
imgList: [],
_skus: [],
isSafe: 1
},
hasToken: !!getToken(),
themeObj: app.globalData.themeObj
};
},
components: {
@ -346,7 +363,8 @@
loading,
poster,
uniPopup,
swipers
swipers,
fileList
},
props: {},
@ -354,76 +372,14 @@
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.setData({ //
colors: app.globalData.newColor
});
this.getLocation(); //
setTimeout(() => {
this.setData({
isShow: false
});
}, 600);
this.colors = app.globalData.newColor
this.themeObj = app.globalData.themeObj
// #ifdef APP-PLUS
this.toBar = app.globalData.toBar + 25 + 'px'
// #endif
this.newVideo = uni.createVideoContext('newVideo');
this.goods = getGoodsDetails();
this.good = this.goods
this.setFrom(this.goods.url); //
this.goodsData.title = this.goods.goodsName;
// this.goodsData.skuSubTitle = this.goods.skuSubTitle.text;
// if(this.goods.dashPrice)
// {this.goodsData.hmoney = this.goods.dashPrice.text;}
this.goodsData.money = parseFloat(this.goods.price);
this.goodsData.img = this.goods.url;
this.goodsData.imgList.push(this.goods.url);
// this.goodsData.imgList.push(this.good.detailPagePic);
this.goodsData.xiaoliang = this.goods.id;
this.goodsData.goods_id = this.goods.id;
if(this.goods.specs){
const specs = this.goods.specs.split('|')
this.goodsData.sku = [{
sku_id: this.goods.id,
skuname: '规格',
child: specs.map((v, index) => {
return {
tagname: v,
id: index + 1,
imgs: '',
money: this.goods.price
}
})
}]
this.goodsData.skuArr = specs.map(v => {
return {
"goods_sku_arr": [
"2011"
],
"goods_sku_text": v,
"img": this.goods.url,
"money": this.goodsData.money,
"stock": 999
}
})
}
if(getlocation()){this.goodsData.stallAddress = getlocation().poiaddress}
this.goodsId = options.id
this.getGoodsById()
},
@ -470,9 +426,9 @@
*/
onShareAppMessage: function() {
return {
title: this.goodsData.title,
path: '/pages/views/goods/goodsDetails',
imageUrl: this.goodsData.img
title: this.goods.goodsName,
path: '/pages/views/goods/goodsDetails?id=' + this.goods.id,
imageUrl: this.goods.url,
}
},
/**
@ -480,12 +436,105 @@
*/
onShareTimeline: function() {
return {
title: this.goodsData.title,
title: this.goods.goodsName,
path: '/pages/views/goods/goodsDetails',
imageUrl: this.goodsData.img
imageUrl: this.goods.url
}
},
methods: {
previewImg(url){ //
let arr = []
arr[0] = url
uni.previewImage({
urls:arr
})
},
getCommits(goods) {
let s = [
{
"rule": "eq",
"type": "string",
"dictCode": "",
"val": goods.id,
"field": "goodId"
},
// {
// "rule": "eq",
// "type": "string",
// "dictCode": "",
// "val": getUserInfo().id,
// "field": "goodId"
// }
]
const params = {
pageNo:1,
pageSize: 5,
superQueryParams: s,
superQueryMatchType: 'and',
"column": "createTime",
order: "desc",
}
params.superQueryParams = encodeURI(JSON.stringify(s))
getCommits(params).then(res => {
const list = res.result.records.map(v => {
v.fileList = getFileList(v.url)
return v
})
console.log(list)
this.commits = list
})
},
getGoodsById() {
uni.showLoading()
getGoodsById({ id: this.goodsId }).then(res => {
uni.hideLoading()
if (res.result) {
this.initGoodsData(res.result)
} else {
this.$toast('商品不存在')
setTimeout(() => {
uni.navigateBack()
}, 1000)
}
})
},
initGoodsData(goods) {
this.goods = goods
this.getCommits(goods)
if (goods.ifSale !== 1) {
this.$toast('该商品已下架')
// uni.navigateBack()
// return
}
this.goods.imgList = [this.goods.url]
this.setFrom(this.goods.url); //
if(this.goods.specs){
const specs = this.goods.specs.split('|')
this.goods._skus = [{
sku_id: this.goods.id,
skuname: '规格',
child: specs.map((v, index) => {
return {
tagname: v,
id: index + 1,
imgs: '',
money: this.goods.price
}
})
}]
}
setGoodsHistory(this.goods)
// this.getLocation(); //
// if(getlocation()){this.goodsData.stallAddress = getlocation().poiaddress}
},
getLocation() {
let that = this;
uni.getLocation({
@ -585,12 +634,12 @@
this.showModal = false
},
openSku() {
if (!this.hasToken) {
this.$toast('请联系客服人员询价')
return
}
this.nowList = this.goodsData
console.log(this.nowList)
this.showModal = true
},
opencoupon() {
this.couponshow = true
@ -620,15 +669,12 @@
return
} else {
this.couponList[index].status = 1 //
uni.showToast({
title: '领取成功',
icon: 'none'
})
this.$toast('领取成功')
}
},
seeAll() { //
uni.navigateTo({
url: '/pages/views/goods/goodsEvaluate'
url: '/pages/views/goods/goodsEvaluate?id=' + this.goods.id
})
}
}

@ -2,100 +2,66 @@
<!-- 商品评价 -->
<view class="evaluate">
<!-- 顶部tab -->
<view class="tabs">
<!-- <view class="tabs">
<view v-for="(item, index) in tabList" :key="index" class="tabs_list" @tap="setTabs(item, index)"
:style="'color:' + (active == index ?colors :'') + ';font-weight:' + (active == index ?'bold' : '500')">
{{item.name}}({{item.number}})
<view class="active" :style="'background:' + colors" v-if="active == index"></view>
</view>
</view>
</view> -->
<!-- 评价列表 -->
<view class="my_evaluate" >
<view class="evaluate_box">
<view class="pingjia">
<view v-if="goodsEva.length !== 0">
<view class="pingjia_box" v-for="(row, indexs) in goodsEva" :key="indexs">
<view class="pingjia">
<view v-if="commits && commits.length > 0">
<view class="pingjia_box" v-for="(row, indexs) in commits" :key="indexs">
<view class="box_top">
<image :src="row.headimg" mode="" class="head"></image>
<image :src="row.headimg || headimg" mode="" class="head"></image>
<view class="right">
<p class="name">{{ row.nickname }}</p>
<p class="name">{{ row.username }}</p>
<p class="p2">
<text class="text1">{{ row.create_time }}</text>
<text class="text2">{{ row.goods_name }}</text>
<text class="text1">{{ row.createTime }}</text>
<text class="text2">{{ row.goodsName }}</text>
</p>
<p class="p3">
<!-- 循环遍历星星 -->
<image src="/static/images/home/stars.png" v-for="i in row.score" :key="i" mode="" ></image>
<block v-if="row.score !== 5">
<image src="/static/images/home/star-no.png" v-for="(s,h) in (5-row.score)" :key="h" mode="" ></image>
</block>
<image src="/static/images/home/stars.png" v-for="i in +row.qualityScore" :key="i" mode="" ></image>
<image src="/static/images/home/star-no.png" v-for="(s,h) in (5-row.qualityScore)" :key="h" mode="" ></image>
</p>
</view>
</view>
<view class="tag_box" v-if="row.tags.length !== 0">
<view class="tag_box" v-if="row.tags">
<view class="tags" v-for="(s,x) in row.tags" :key="x">{{s}}</view>
</view>
<view class="ping_neirong">{{ row.comment }}</view>
<view class="ping_img" v-if="row.images.length !== 0 || row.video.length !== 0">
<image :src="s" mode="" v-for="(s,x) in row.images" :key="x" @click="preview(row.images, x)"></image>
<view class="video" v-for="(video, videos) in row.video" :key="String(videos+1)">
<!-- 建议设置视频封面 封面壁纸为https网络图片 video层级高会覆盖loading 所以先隐藏-->
<video v-if="isShow == false" :controls="false" id="coverVideo" :src="video.videourl" :poster="video.poster" :show-center-play-btn="false" :show-play-btn="false" :enable-progress-gesture="false">
<cover-view class="covers"></cover-view>
<cover-image class="imgs" v-if="showVideo == false" src="/static/images/goods/bofang.png" mode="" @click="onplayVideos" :data-videos="video.videourl"></cover-image>
</video>
</view>
</view>
<!-- 回复 -->
<view class="ping_neirong">{{ row.content }}</view>
<fileList v-model="row.fileList" :show-colse-btn="false" :show-title="false"></fileList>
<view class="huifu" v-if="row.reply && row.reply !== ''">{{ row.reply }}</view>
</view>
<p class="onbottom"> 到底了 </p>
</view>
</view>
</view>
</view>
<!-- 预览视频弹窗 -->
<view class="mask" v-if="showVideo == true" @touchmove.stop.prevent="ondefault" @click="closeVideo">
<view class="close">
<image src="/static/images/goods/close.png"></image>
</view>
</view>
<view class="previewvideo" v-if="showVideo == true">
<view class="videos">
<video class="nowvideos" id="nowVideo" v-if="showVideo == true" :src="videos" :autoplay="showVideo"
:show-center-play-btn="false" :show-mute-btn="true" :show-fullscreen-btn="false"></video>
</view>
</view>
</view>
<!-- 用来兼容H5操作的 -->
<view style="position: absolute;top: -999upx;left: -999upx;">
<video ref="nowVideo" id="newVideo" :src="videos"
:autoplay="showVideo"
:show-center-play-btn="true" :show-mute-btn="true" :show-fullscreen-btn="false"></video>
</view>
<nodata v-if="goodsEva.length == 0" :colors="colors"></nodata>
<loading v-if="isShow == true"></loading>
</video>
<nodata v-if="commits.length == 0" :colors="colors"></nodata>
</view>
</template>
<script>
let app = getApp()
import loading from "../../commponent/public/loading";
import { getCommits } from "@/api";
import tabs from '../../commponent/public/tabs.vue'
import { getFileList } from '@/utils/util.js'
import fileList from '@/pages/commponent/public/fileList.vue'
let app = getApp()
export default {
components: {
tabs,
loading
fileList
},
data() {
return {
colors: '',
temporary:[],
platform:'',
isShow:true,
videos:'',
showVideo:false,
tabList: [{
name: '最新',
number: 10,
@ -118,64 +84,62 @@
id: 4
}],
active: 0,
goodsEva:[ //
{headimg:'/static/images/face.jpg',nickname:'反转',create_time:'2020-09-10 15:36',goods_name:'测试规格1', score:5,comment:'产品很不错,赞',images:['/static/images/goods/two.jpg','/static/images/goods/one.jpg'],reply:'感谢您的支持',tags:['价格合理','味道好','价格优惠','态度好'],video:[]},
{headimg:'/static/images/face.jpg',nickname:'清风',create_time:'2020-09-10 13:36',goods_name:'测试规格2', score:4,comment:'针不戳,住在山里面针不戳~',images:['/static/images/goods/two.jpg'],reply:'',tags:[],video:[{vid:1,videourl:'https://fzdz.soft.haoyangsoft.com/uploads/system/videos/20200813/6c819d24ee6868aee33e150c4333329b.mp4',poster:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1603080909940&di=ac10c5f2c952dd1b40441bb696c55a88&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn%2Fw640h640%2F20180127%2F369b-fyqzcxh1087346.jpg"}]},
{headimg:'/static/images/face.jpg',nickname:'明月',create_time:'2020-09-10 15:36',goods_name:'测试规格2', score:5,comment:'产品很不错,赞',images:['/static/images/goods/two.jpg','/static/images/goods/one.jpg'],reply:'感谢您的支持',tags:['价格合理','态度好'],video:[]},
]
headimg:'/static/images/face.jpg',
goodsId: null,
commits: []
}
},
onReady() {
this.newVideo = uni.createVideoContext('newVideo');
this.nowVideo = uni.createVideoContext('nowVideo');
},
onLoad() {
this.platform = uni.getSystemInfoSync().platform //ios
onReady() {},
onLoad(options) {
this.goodsId = options.id
this.colors = app.globalData.newColor; //
this.temporary = this.goodsEva
setTimeout(()=>{
this.isShow = false
},600)
this.getCommits(this.goodsId)
},
methods:{
ondefault(){ //
getCommits(goodsId) {
if (!goodsId) {
uni.navigateBack()
return
}
let s = [
{
"rule": "eq",
"type": "string",
"dictCode": "",
"val": goodsId,
"field": "goodId"
}
]
const params = {
pageNo:1,
pageSize: 5,
superQueryParams: s,
superQueryMatchType: 'and',
"column": "createTime",
order: "desc",
}
uni.showLoading({
mask: true
})
params.superQueryParams = encodeURI(JSON.stringify(s))
getCommits(params).then(res => {
uni.hideLoading()
const list = res.result.records.map(v => {
v.fileList = getFileList(v.url)
return v
})
this.commits = list
})
},
setTabs(item,index){ //
this.active = index
this.goodsEva = index == 0 ? this.temporary : []
// this.goodsEva = index == 0 ? this.temporary : []
},
preview(imgs, index){ //
uni.previewImage({
current:index,
urls:imgs
})
},
onplayVideos(video){
this.videos = video.currentTarget.dataset.videos
// #ifdef MP
// ,H5
this.showVideo = true
setTimeout(()=>{
// this.nowVideo.play()
},300)
// #endif
// #ifdef APP-PLUS
// APP
this.showVideo = true
// #endif
// #ifdef H5
// H5video
if(this.platform == 'android'){
this.newVideo.play();
}else{
this.showVideo = true
}
// #endif
},
closeVideo(){
this.showVideo = false
}
}
}
</script>
@ -317,56 +281,6 @@
color: rgba(0, 0, 0, 1);
line-height: 50upx;
}
.ping_img {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
align-content: flex-start;
justify-content: space-between;
margin-top: 20upx;
&::after {
content: '';
max-width: 29vw;
min-width: 29vw;
}
image,video {
max-width: 29vw;
min-width: 29vw;
height: 29vw;
border-radius: 5upx;
margin-bottom: 20upx;
}
.video{
position: relative;
max-width: 29vw;
min-width: 29vw;
height: 29vw;
overflow: hidden;
border-radius: 5upx;
video{
overflow: hidden;
position: relative;
border-radius: 5upx;
.covers{ //
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 9990;
}
.imgs{
width: 72upx;
height: 72upx;
position: absolute;
top: 50%;
left: 50%;
z-index: 9999;
transform: translate(-50% ,-50%);
}
}
}
}
.huifu {
padding: 20upx;
background-color: #f3f3f3;
@ -387,62 +301,5 @@
font-size: 24upx;
color: #ccc;
}
/* 预览视频弹窗 */
.mask{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0,0,0,.8);
z-index: 200;
}
.previewvideo {
width: 100vw;
height: 100vw;
position: fixed;
top: 50%;
left: 0;
transform: translateY(-50%);
background-color: #000;
z-index: 900;
opacity: 1;
}
.close {
display: flex;
align-content: center;
align-items: flex-end;
position: absolute;
top: 100upx;
left: 20upx;
z-index: 900;
image {
width: 50upx;
height: 50upx;
display: block;
justify-content: center;
margin-left: 30upx;
margin-bottom: 20upx;
border-radius: 50%;
padding: 10upx;
background-color: rgba(0, 0, 0, 0.2);
}
}
.videos {
height: 100vw;
width: 100vw;
z-index: 10;
position: relative;
video{
width: 100%;
height: 100%;
}
}
.nowvideos {
width: 100%;
height: 100%;
margin: 0 auto;
}
</style>

@ -7,10 +7,10 @@
</view>
</swiper-item>
</swiper>
<view class="dots" v-if="goodsData.imgList.length !== 0">
<view class="dots" v-if="goodsData.imgList.length > 0">
<text>{{currentIndex}}</text> / <text>{{goodsData.imgList.length}}</text>
</view>
<view class="video_btn" @click="onshowVideo" v-if="goodsData.videos !== ''">
<view class="video_btn" @click="onshowVideo" v-if="goodsData.videos">
<text>{{minutes}}'{{seconds}}'</text>
<!-- 这里的视频时间 建议后端上传视频时进行计算 返回给前端 前端兼容多端的情况下计算起来比较复杂 -->
</view>
@ -24,7 +24,7 @@
currentIndex: 1,
showVideo: false,
minutes:'00',
seconds:'18',
seconds:'10',
isH5: false ,//H5
platform:'',
videos:''
@ -32,7 +32,10 @@
},
props: {
goodsData: {
type: Object
type: Object,
default: () => ({
imgList: []
})
}
},
created() {

@ -30,18 +30,20 @@
<image @tap="oldDelete" src="/static/images/search/delete.png"></image>
</view>
</view>
<scroll-view scroll-x="true" class="">
<view class="keyword">
<view v-for="(item, index) in oldKeywordList" :key="index" @tap="ondoSearch(item)">{{item}}</view>
</view>
</scroll-view>
</view>
<scroll-view scroll-y="true" >
<view class="goods-box">
123
<view class="keyword">
<view v-for="(item, index) in oldKeywordList" :key="index" @tap="ondoSearch(item)">{{item}}</view>
</view>
</scroll-view>
</view>
<scroll-view scroll-y="true" class="" @scrolltolower="getMoreGoods"
style="height: calc(100vh - 450upx);">
<goodList style="width: 100%; background-color: #FFFFFF;"
:loading="isLoading"
:has-token="hasToken"
:has-more="!isNoMore"
:propsList="goodsList" ></goodList>
</scroll-view>
</view>
</view>
@ -50,6 +52,8 @@
<script>
import { getGoodsList } from '@/api/index.js'
import goodList from '@/pages/commponent/home/goodList';
import { getToken } from '@/utils/auth';
var app = getApp();
export default {
data() {
@ -63,11 +67,18 @@ export default {
isShowKeywordList: false,
shows: false,
colors: '',
goodsList: []
goodsList: [],
pageNo: 1,
pageSize: 6,
isNoMore: false,
isLoading: true,
hasToken: false
};
},
components: {},
components: {
goodList
},
props: {},
/**
@ -103,22 +114,30 @@ export default {
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
onPullDownRefresh: function () {
console.log(321)
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
methods: {
getMoreGoods() {
if (this.isNoMore) return
this.pageNo ++
this.getGoodsList(this.keyword)
},
getGoodsList(val = '') {
this.hasToken = !!getToken()
const s = [
{
"rule": "eq",
"type": "string",
"dictCode": "",
"val": "1",
"field": "ifSale"
},
// {
// "rule": "eq",
// "type": "string",
// "dictCode": "",
// "val": "0",
// "field": "ifSale"
// },
{
"rule": "like",
"type": "string",
@ -142,18 +161,21 @@ export default {
}
]
const params = {
pageNo:1,
pageSize: 100,
pageNo: this.pageNo,
pageSize: this.pageSize,
superQueryParams: encodeURI(JSON.stringify(s)),
superQueryMatchType: 'or'
}
uni.showLoading()
getGoodsList(params).then(res => {
this.goodsList = res.result.records
const list = res.result.records
this.goodsList = [...this.goodsList, ...list]
uni.hideLoading()
this.isNoMore = list.length < this.pageSize
})
},
init() {
this.loadDefaultKeyword();
this.loadOldKeyword();
@ -190,10 +212,15 @@ export default {
if (this.keyword && this.keyword !== '') {
this.saveKeyword(this.keyword); //
}
this.pageNo = 1
this.goodsList = []
this.isNoMore = false
this.isLoading = true
uni.pageScrollTo({
scrollTop: 0,
duration: 300
});
uni.showLoading({
title: '搜索中...'
});
this.setData({
keywordList: []
});
@ -223,7 +250,7 @@ export default {
} //10
OldKeys.length > 10 && OldKeys.pop();
OldKeys.length > 6 && OldKeys.pop();
uni.setStorage({
key: 'OldKeys',
data: JSON.stringify(OldKeys)
@ -252,13 +279,13 @@ export default {
content: '确定清除历史搜索记录?',
success: res => {
if (res.confirm) {
console.log('用户点击确定');
this.setData({
oldKeywordList: []
});
this.oldKeywordList = []
this.goodsList = []
this.isLoading = false
uni.removeStorage({
key: 'OldKeys'
});
} else if (res.cancel) {
console.log('用户点击取消');
}
@ -279,7 +306,12 @@ export default {
},
ondoSearch(item) { //
console.log(item)
this.keyword = item
this.pageNo = 1
this.isNoMore = false
this.isLoading = true
this.goodsList = []
this.getGoodsList(item)
},
jumpData(value) {
@ -293,13 +325,20 @@ export default {
</script>
<style scoped lang="scss">
view{display:block;}
.search-box {background-color:rgb(242,242,242);padding:15upx 2.5%;display:flex;justify-content:space-between;position:sticky;top: 0;}
.search-box {
background-color:rgb(242,242,242);padding:15upx 2.5%;display:flex;justify-content:space-between;position:sticky;top: 78upx;z-index: 99;}
.search-box .mSearch-input-box{width: 100%;}
.search-box .input-box {width:85%;flex-shrink:1;display:flex;justify-content:center;align-items:center;}
.search-box .search-btn {width:15%;margin:0 0 0 2%;display:flex;justify-content:center;align-items:center;flex-shrink:0;font-size:24upx;color:#fff;background:linear-gradient(to right,#4492EB,#3F92EE);border-radius:60upx;}
.search-box .input-box>input {width:95%;height:60upx;font-size:24upx;-webkit-appearance:none;-moz-appearance:none;appearance:none;margin:0;background-color:#ffffff;}
.placeholder-class {color:#9e9e9e;}
.search-keyword {width:100%;background-color:rgb(242,242,242);}
.search-keyword {
width:100%;background-color:rgb(242,242,242);
position: sticky;
z-index: 98;
top: 190upx;
}
.keyword-list-box {height:calc(100vh - 110upx);padding-top:10upx;border-radius:20upx 20upx 0 0;background-color:#fff;}
.keyword-entry-tap {background-color:#eee;}
.keyword-entry {width:94%;height:80upx;margin:0 3%;font-size:30upx;color:#333;display:flex;justify-content:space-between;align-items:center;border-bottom:solid 1upx #e7e7e7;}
@ -307,13 +346,35 @@ view{display:block;}
.keyword-entry .keyword-text,.keyword-entry .keyword-img {height:80upx;display:flex;align-items:center;}
.keyword-entry .keyword-text {width:90%;}
.keyword-entry .keyword-img {width:10%;justify-content:center;}
.keyword-box {height:calc(100vh - 110upx);border-radius:20upx 20upx 0 0;background-color:#fff;}
.keyword-box {
// height:calc(100vh - 110upx);
border-radius:20upx 20upx 0 0;background-color:#fff;}
.keyword-box .keyword-block {padding:10upx 0;}
.keyword-box .keyword-block .keyword-list-header {width:94%;padding:10upx 3%;font-size:27upx;color:#333;display:flex;justify-content:space-between;}
.keyword-box .keyword-block .keyword-list-header image {width:40upx;height:40upx;}
.keyword-box .keyword-block .keyword {width:94%;padding:3px 3%;display:flex;flex-flow:wrap;justify-content:flex-start;}
.keyword-box .keyword-block .keyword {
// width:94%;
padding:3px 20upx;
height: 200upx;
display:flex;
flex-flow:wrap;
// overflow-x: scroll;
// justify-content:
}
.keyword-box .keyword-block .hide-hot-tis {display:flex;justify-content:center;font-size:28upx;color:#6b6b6b;}
.keyword-box .keyword-block .keyword>view {display:flex;justify-content:center;align-items:center;border-radius:38upx;padding:0 20upx;margin:10upx 20upx 10upx 0;height:60upx;font-size:24upx;background-color:rgb(242,242,242);color:#6b6b6b;line-height: 60upx;}
.keyword-box .keyword-block .keyword>view {
display:flex;justify-content:center;
align-items:center;border-radius:38upx;
padding:0 20upx;
margin-left: 28upx;
height:60upx;
font-size:24upx;
background-color:rgb(242,242,242);
color:#6b6b6b;
line-height: 60upx;
width: 200upx;
overflow: hidden;
}
.search_text{
font-size: 24upx;
color: #B6B6C6;

@ -1,5 +1,5 @@
<template>
<view class="order">
<view class="order" :class="['theme', themeObj.name ]">
<!-- 选择配送方式 -->
<!-- @tap="selectMode" -->
<view class="mode" >
@ -12,7 +12,7 @@
<image src="/static/images/home/bottom.png"></image>
<view class="address_box" @tap="setAddress">
<view class="weizhi_icon">
<text class="iconfont icon-dizhi" :style="'color:' + colors"></text>
<text class="iconfont icon-dizhi"></text>
</view>
<block v-if="address">
<view class="center">
@ -32,7 +32,7 @@
<view v-for="(item, index) in goodsList" :key="index" class="goods">
<view class="goods_data">
<image :src="item.selectSku.img" mode="widthFix" v-if="item.selectSku"></image>
<image :src="item.img" mode="widthFix" ></image>
<image :src="item.url" mode="widthFix" ></image>
<view class="goods_title">
<view class="g_name">
{{item.title}}
@ -45,12 +45,12 @@
<text style="margin-right: 10upx;" v-else></text>
</view>
<view class="price">
<view class="t1" :style="'color:' + colors">{{item.money}}</view>
<view class="t1">{{item.price}}</view>
<view class="t2" v-if="item.hmoney">
<text>{{item.hmoney}}</text>
</view>
<view class="t3">
x{{item.number}}
x{{item.number}}/{{ item.unit }}
</view>
</view>
</view>
@ -75,7 +75,7 @@
</view>
<view class="morelist">
<view class="title">
<text class="quan" :style="'background:' + colors"></text>
<text class="quan"></text>
<text>运费</text>
</view>
<view class="right_title">
@ -84,7 +84,7 @@
</view>
<view class="morelist">
<text class="title">实付款</text>
<view class="right_title" :style="'color:' + colors + ';'">
<view class="right_title">
{{sumprice}}
</view>
</view>
@ -97,9 +97,9 @@
</view>
<view class="bottom_btn">
<view class="moneys">
合计: <text :style="'color:' + colors + ';'">{{sumprice}}</text>
合计: <text class="price">{{sumprice}}</text>
</view>
<view class="btns" :style="'background:' + colors + ';'" @tap="submit">
<view class="btns" @tap="submit">
提交订单
</view>
</view>
@ -123,7 +123,7 @@ import { addOrder } from "../../../api";
export default {
data() {
return {
colors: '',
couponshow: false,
modes: '物流寄送',
tapIndex: 0,
@ -151,7 +151,8 @@ export default {
status: 0,
condition: ['新人专享']
}
]
],
themeObj: app.globalData.themeObj
};
},
@ -167,9 +168,6 @@ export default {
removeAddress() //
//
this.getSumPrice()
this.setData({
colors: app.globalData.newColor
});
},
/**
@ -217,7 +215,7 @@ export default {
getSumPrice(){
let sumprice = 0
this.goodsList.forEach(e=>{
sumprice += e.number * resetNum(e.money)
sumprice += e.number * resetNum(e.price)
})
sumprice += resetNum(this.freight)
this.sumprice = resetNum(sumprice, 'end')
@ -238,16 +236,13 @@ export default {
submit() {
if (!this.address) {
uni.showToast({
icon: 'none',
title: '请先选择地址'
})
this.$toast('请先选择地址')
return
}
const cartList = getCart()
const goodsIds = this.goodsList.map(v => v.goods_id)
const goodsIds = this.goodsList.map(v => v.id)
const newCartList = cartList.filter(v => !goodsIds.includes(v.goods_id))
const newCartList = cartList.filter(v => !goodsIds.includes(v.id))
const params = {
"recipient": this.address.recipient,
@ -255,10 +250,10 @@ export default {
"mobile": this.address.telephone,
"orderDetailList": this.goodsList.map(v => {
return {
goodsId: v.goods_id,
goodsName: v.title,
goodsId: v.id,
goodsName: v.goodsName,
goodsNo: v.number,
goodsPrice: v.money
price: v.price
}
}),
state: 0,
@ -277,10 +272,7 @@ export default {
uni.hideLoading()
this.isConfirm = false
if (res.result) {
uni.showToast({
icon: 'none',
title: '添加成功'
})
this.$toast('添加成功')
resetCart(newCartList)
setTabBarBadge(newCartList.length)
//

@ -238,184 +238,4 @@
transform: translateY(-5upx);
}
}
}
.youhui {
height: 40upx;
line-height: 40upx;
padding: 20upx 30upx;
border-bottom: 1upx solid #f2f2f2;
box-sizing: content-box;
.text1 {
font-size: 28upx;
color: #333333;
}
.text2 {
float: right;
color: #999999;
font-size: 28upx;
margin-right: 5upx;
margin-top: 2upx;
}
.text3 {
font-size: 24upx;
color: #999999;
margin-left: 10upx;
}
image {
float: right;
width: 12upx;
height: 22upx;
margin-top: 12upx;
margin-left: 10upx;
}
}
.img_box {
overflow: hidden;
padding: 20upx 30upx;
.addImg {
width: 184upx;
height: 184upx;
background: #f2f2f2;
// background-color: pink;
border-radius: 20upx;
overflow: hidden;
transition: all 0.3s;
image {
width: 51upx;
height: 42upx;
display: block;
margin: 0 auto;
margin-top: 45upx;
}
p {
font-size: 24upx;
font-family: Microsoft YaHei;
font-weight: 400;
color: rgba(255,94,102,1);
text-align: center;
margin-top: 20upx;
}
&:active {
transform: scaleX(0.96);
}
}
}
.img_list {
width: 184upx;
height: 184upx;
float: left;
margin-right: 20upx;
position: relative;
overflow: hidden;
margin-bottom: 20upx;
image,video {
width: 100%;
height: 100%;
display: block;
}
video{
position: relative;
border-radius: 5upx;
overflow: hidden;
overflow: visible!important;
.covers{ //
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 9990;
}
.imgs{
width: 72upx;
height: 72upx;
position: absolute;
top: 50%;
left: 50%;
z-index: 9999;
transform: translate(-50% ,-50%);
}
.video_close{
width: 40upx;
height: 40upx;
position: absolute;
display: block;
top: -6upx;
left: -6upx;
border-radius: 50%;
z-index: 9999;
}
}
.close {
width: 40upx;
height: 40upx;
position: absolute;
box-sizing: border-box;
top: -6upx;
left: -6upx;
border-radius: 50%;
}
}
/* 预览视频弹窗 */
.mask {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, .8);
z-index: 200;
}
.previewvideo {
width: 100vw;
height: 100vw;
position: fixed;
top: 50%;
left: 0;
transform: translateY(-50%);
background-color: #000;
z-index: 900;
opacity: 1;
}
.close {
display: flex;
align-content: center;
align-items: flex-end;
position: absolute;
top: 100upx;
right: 20upx;
z-index: 900;
image {
width: 50upx;
height: 50upx;
display: block;
justify-content: center;
margin-left: 30upx;
margin-bottom: 20upx;
border-radius: 50%;
padding: 10upx;
background-color: rgba(0, 0, 0, 0.2);
}
}
.videos {
height: 100vw;
width: 100vw;
z-index: 10;
position: relative;
video {
width: 100%;
height: 100%;
}
}
.nowvideos {
width: 100%;
height: 100%;
margin: 0 auto;
}
}

@ -2,241 +2,189 @@
<view>
<view class="evaluate">
<view class="goods_data">
<image :src="goodData.img" mode=""></image>
<image :src="goodData.url" mode=""></image>
<view class="right">
<p class="goods_name">{{goodData.title}}</p>
<p class="goods_sku">{{goodData.goods_sku_text}}</p>
<p class="goods_name">{{goodData.goodsName}}</p>
<p class="goods_sku">{{goodData.specs}}</p>
<p class="goods_price">
<text style="font-size: 24upx;">数量x{{goodData.number}}</text>
<text :style="{color:colors}">{{goodData.money}}</text>
<text :style="{color:colors}">{{goodData.price}}</text>
<text style="font-size: 28upx;">x{{goodData.goodsNo}} /{{ goodData.unit }}</text>
</p>
</view>
</view>
<view class="Rate">
<p>整体评价</p>
<view class="star">
<image :src="item.img" mode="" v-for="(item,index) in stars" :key="index" @click="setStar(item,index)"></image>
<p>商品评分</p>
<view class="star" v-for="star in starsBox1" :key="star.name">
<image
:src="
item <= star.num ?
starImg
:
starNoImg
"
mode=""
v-for="(item,index) in starNum" :key="index" @click="setStar1(item, star)"></image>
</view>
</view>
<view class="pingjia_box">
<textarea placeholder="说说您的感受..." maxlength="-1" v-model="comment" />
<textarea placeholder="说说您的感受..." maxlength="-1" v-model="content" :disabled="!!commit" />
</view>
<p class="youhui" style="border-bottom: none;">
<text class="text1">上传图片</text>
<text class="text3">(最多3张)</text>
</p>
<view class="img_box" >
<view class="img_list" v-for="(item, index) in imgUrl" :key="index">
<block v-if="item.type == 1">
<image :src="item.url" mode="" class="imgs" @click="previewImg(item.url)"></image>
<image z-index="9999" src="/static/images/search/close.png" mode="" class="close" @tap="delImg(index)"></image>
</block>
<block v-if="item.type == 2">
<video :src="item.url" :poster="item.poster" :controls="false" :show-center-play-btn="false" :show-play-btn="false" :enable-progress-gesture="false">
<cover-view class="covers"></cover-view>
<cover-image v-if="showVideo == false" class="imgs" src="/static/images/goods/bofang.png" mode="" @click="onshowVideo(item.url)"></cover-image>
<cover-image v-if="showVideo == false" src="/static/images/search/close.png" mode="" class="video_close" @tap="delImg(index)"></cover-image>
</video>
</block>
</view>
<view class="addImg"v-if="imgUrl.length < 3" @tap="onChoose">
<image src="/static/images/shexiang.png" mode=""></image>
<p>添加图片/视频</p>
<view class="Rate">
<p>综合评分</p>
<view class="star" v-for="_star in starsBox" :key="_star.name">
{{ _star.name }}
<image
:src="
item <= _star.num ?
starImg
:
starNoImg
"
mode=""
v-for="item in starNum"
:key="item"
@click="setStar1(item, _star, 'more')"></image>
</view>
</view>
</view>
</view>
<view class="btns" :style="{background:colors}" @click="submit"></view>
<!-- 预览视频弹窗APP 小程序 -->
<view class="mask" v-if="showVideo == true" @touchmove.stop.prevent="ondefault" @click="hideShow">
<view class="close">
<image src="/static/images/goods/close.png"></image>
</view>
</view>
<view class="previewvideo" v-if="showVideo == true">
<view class="videos">
<video class="nowvideos" id="nowVideo" v-if="showVideo == true" :src="videos" :autoplay="showVideo"
:show-center-play-btn="true" :show-mute-btn="true" :show-fullscreen-btn="false"></video>
</view>
</view>
<!-- 用来承载H5预览视频的 -->
<view style="position: absolute;top: -999upx;left: -999upx;">
<video ref="newVideo" id="newVideo" :src="videos"
:autoplay="showVideo"
:show-center-play-btn="false" :show-mute-btn="true" :show-fullscreen-btn="false"></video>
<fileList v-model="imgUrl" :show-colse-btn="fileListFlag.showCloseBtn"></fileList>
</view>
<view class="btns" :style="{background:colors}" @click="submit" v-if="!commit"></view>
</view>
</template>
<script>
import { getSalesGoodsItem, getToken, getUserInfo, removeToken, removeUserInfo, rmSalesGoodsItem } from '@/utils/auth';
import { addCommit, getCommit, uploadFile } from '@/api';
import fileList from '@/pages/commponent/public/fileList.vue'
import CONFIG from '@/config'
import { getFileList } from '@/utils/util.js'
var app = getApp();
export default {
components: {
fileList
},
data() {
return {
value: 5,
showVideo:false,
isH5: false,
videos:'',
comment:'',
platform:'',
imgUrl:[],//
goodData:{},
content:'',
colors:'',
stars: [
{id: 1,types: true,img:'/static/images/home/stars.png'},
{id: 2,types: true,img:'/static/images/home/stars.png'},
{id: 3,types: true,img:'/static/images/home/stars.png'},
{id: 4,types: true,img:'/static/images/home/stars.png'},
{id: 5,types: true,img:'/static/images/home/stars.png'},
],
goodData:{},
imgUrl:[],//
starNoImg:'/static/images/home/star-no.png',
starImg:'/static/images/home/stars.png',
starValue: 5
starNum: 5,
imgNum: 5,
commit: null,
fileListFlag: {
showCloseBtn: false,
showAddBtn: false
},
starsBox1: [
{
name: '商品评价',
num: 0
}
],
starsBox: [
{
name: '推荐',
num: 0
},
{
name: '物流',
num: 0
},
{
name: '服务',
num: 0
}
]
};
},
created() {
this.platform = uni.getSystemInfoSync().platform //ios
this.newVideo = uni.createVideoContext('newVideo');
},
created() {},
onLoad(options) {
let goodData = JSON.parse(options.goodData)
this.setData({
colors: app.globalData.newColor,
goodData:goodData
});
const id = options.id !== '0' ? options.id : '0'
this.getCommit(id)
},
methods: {
delImg(index) {
//
this.imgUrl.splice(index, 1);
},
onChoose(){
uni.showActionSheet({
title:"选择上传类型",
itemList: ['图片','视频'],
success: (res) => {
console.log(res)
if(res.tapIndex == 0){
this.chooseImages()
} else {
this.chooseVideo()
}
}
})
},
chooseImages() { //
let that = this;
uni.chooseImage({
//
count: 1, //
sizeType: ['original', 'compressed'], //
success: function(res) {
//
console.log(res);
// imgUrl
if(that.imgUrl.length >= 3){ //3
uni.showToast({
title:'最多上传3个',
icon:'none'
})
}else{ //
let img = {url:'/static/images/goods/four.jpg',type: 1}
that.imgUrl.push(img)
}
}
});
},
chooseVideo(){ //
let that = this;
uni.chooseVideo({
count: 1,
sourceType: ['camera', 'album'],
success: function (res) {
console.log(res) //
//
if(that.imgUrl.length >= 3){ //3
uni.showToast({
title:'最多上传3个',
icon:'none'
})
}else{ //
/**
* ***重点注意
* 视频的封面图因为需要做多端兼容 并且只允许是网络图片
* 所有建议是上传视频给后端之后然后由后端对视频进行截取
* 建议截取视频的第5帧来生成图片并返回给前端
* 下面的poster是模拟后台返回的封面
*/
let video = {url:'https://fzdz.soft.haoyangsoft.com/uploads/system/videos/20200813/6c819d24ee6868aee33e150c4333329b.mp4',type: 2,poster:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1603080909940&di=ac10c5f2c952dd1b40441bb696c55a88&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn%2Fw640h640%2F20180127%2F369b-fyqzcxh1087346.jpg'}
that.imgUrl.push(video)
}
}
getCommit(id) {
const goodData = getSalesGoodsItem()
this.setData({
colors: app.globalData.newColor,
goodData
});
},
setStar(item,index){ //
let that = this
if(item.types == false){
for(var i = 0; i<=index;i++){
console.log(that.stars[i].types)
that.stars[i].types = true
that.stars[i].img = that.starImg
}
}else{
for(var i = index+1; i<that.stars.length;i++){
console.log(that.stars[i].types)
that.stars[i].types = false
that.stars[i].img = that.starNoImg
}
const hasId = id !== '0'
this.fileListFlag.showCloseBtn = !hasId
if (hasId) {
uni.showLoading()
getCommit({ id }).then(res => {
uni.hideLoading()
this.commit = res.result
const imgUrl = getFileList(this.commit.url)
this.starsBox1[0].num = this.commit.qualityScore
this.starsBox[0].num = this.commit.suggestScore
this.starsBox[1].num = this.commit.deliveryScore
this.starsBox[2].num = this.commit.serviceScore
this.content = this.commit.content
this.imgUrl = imgUrl
})
}
this.$forceUpdate() //
let value = this.stars.filter((e)=>{
return e.types == true
})
this.starValue = value.length
},
previewImg(url){ //
let arr = []
arr[0] = url
uni.previewImage({
urls:arr
})
},
onshowVideo(video) { //
this.videos = video
// #ifndef H5
this.showVideo = true
// #endif
// #ifdef H5
// h5
if(this.platform == 'android'){ //ios
this.isH5 = true
this.newVideo.play()
}else{
this.showVideo = true
setStar1(index, item, type = 'box1') {
if (this.commit) {
return
}
// #endif
},
hideShow(){ //
this.showVideo = false
item.num = index
if (type === 'box1') {
this.starsBox1 = [...this.starsBox1]
return
}
this.starsBox = [...this.starsBox]
},
submit(){ //
let imgs = this.imgUrl.filter((e)=>{ //
return e.type == 1
})
let videos = this.imgUrl.filter((e)=>{
return e.type == 2
})
uni.showToast({
title:'提交成功'
})
setTimeout(()=>{
uni.navigateBack({
delta:2
})
},1500)
if (this.content.length < 2) {
this.$toast('评价字数不少于2个字')
return
}
if (this.starsBox1[0].num < 1 || this.starsBox.some(v => v.num < 1)) {
this.$toast('您忘记评分了')
return
}
const params = {
"orderId": this.goodData.orderId,
"content": this.content,
"goodId": this.goodData.goodsId,
"goodsName": this.goodData.goodsName,
"qualityScore": this.starsBox1[0].num,
"suggestScore": this.starsBox[0].num,
"deliveryScore": this.starsBox[1].num,
"serviceScore": this.starsBox[2].num,
"url": this.imgUrl.length > 0 ? this.imgUrl.map(v => v._url).join(',') : '',
"userId": getUserInfo().id,
"userName": getUserInfo().username
}
uni.showLoading({
mask:true
})
addCommit(params).then(res => {
uni.hideLoading()
if (res.result) {
this.$toast('评价成功')
setTimeout(() => {
uni.navigateBack()
}, 1000)
} else {
this.$toast(res.message)
}
})
},
ondefault(){
//
}
},
onShow() {
@ -246,9 +194,9 @@ export default {
<style lang="scss" scoped>
@import "./evaluate.scss";
</style>
<style>
page{
page{
background-color: #F8F8F8;
}
</style>

@ -11,65 +11,67 @@
<block>
<view class="center">
<view class="name">
<text class="text1">张飞</text>
<text class="phones">1829445646451</text>
<text class="text1">{{ goods.recipient }}</text>
<text class="phones">{{ goods.mobile }}</text>
</view>
<view class="address_name">北京市海淀区苏家坨乡前沙涧村15号</view>
<view class="address_name">{{ goods.addr.split(',')[0] }}{{ goods.addr.split(',')[1] }}</view>
</view>
</block>
</view>
</view>
<!-- 商品详情 -->
<view v-for="(item, index) in orderList.goods" :key="index" class="goods">
<view class="goods_data">
<image :src="item.img"></image>
<view v-for="(item, index) in goods.orderDetailList" :key="index" class="goods">
<view class="goods_data" @tap="goGoodsDetail(item)">
<image :src="item.url"></image>
<view class="goods_title">
<view class="g_name">
{{item.title}}
{{item.goodsName}}
</view>
<view class="goods_sku">
规格: {{item.goods_sku_text}}
规格: {{item.specs}}
</view>
<view class="price">
<view class="t1" :style="'color:' + colors">{{item.money}}</view>
<view class="t1" :style="'color:' + colors">{{item.price}}</view>
<view class="t3">
x{{item.number}}
x{{item.goodsNo}}{{item.unit}}
</view>
</view>
</view>
</view>
<view class="morelist" style="border-bottom:none">
<view class="title">
<!-- <view class="title">
<text class="quan" :style="'background:' + colors"></text>
<text>优惠券</text>
</view>
<view class="right_title" :style="'color:' + colors + ';font-size:24upx'">
减20
</view>
</view> -->
</view>
<!-- 单商品操作按钮 在订单状态为待评价时才会显示-->
<view class="goods_btns" v-if="status == 3">
<view class="goods_btns" v-if="goods.state === 3">
<view class="btns" style="margin-right: 40upx;" @click="onafterSale(item)">
申请售后
</view>
<view class="btns" @click="onevaluate(item)" :style="{borderColor:colors,color:colors}">
去评价
<view class="btns"
@click="onevaluate(item)" :style="{borderColor:colors,color:colors}">
{{ item.commitId ? '查看评价' : '去评价'}}
</view>
</view>
</view>
<!-- 核销码 -->
<view class="order_ewm">
<!-- <view class="order_ewm">
<view class="ewm_title">我的核销码</view>
<view class="center_ewm">
<image src="/static/images/ewm.png"></image>
</view>
</view>
</view> -->
<!-- 订单详情 -->
<view class="order_more">
<view class="morelist">
<text class="title">商品总价</text>
<view class="right_title">
{{orderList.sumprice}}
{{goods.totalAmount}}
</view>
</view>
<view class="morelist">
@ -84,59 +86,88 @@
<view class="morelist">
<text class="title">实付款</text>
<view class="right_title" :style="'color:' + colors + ';'">
{{orderList.sumprice}}
{{goods.totalAmount}}
</view>
</view>
<view class="morelist">
<text class="title">订单编号</text>
<view class="right_title">
{{orderList.order_No}}
<text class="copy" @click="onCopy(orderList.order_No)"></text>
{{goods.id}}
<text class="copy" @click="onCopy(goods.id)"></text>
</view>
</view>
<view class="morelist" v-if="goods.logisticsId">
<text class="title">物流单号</text>
<view class="right_title">
{{goods.logisticsId}}
<text class="copy" @click="onCopy(goods.logisticsId)"></text>
</view>
</view>
<view class="morelist">
<text class="title">创建时间</text>
<view class="right_title">
2020-08-02 21:09:26
</view>
</view>
<view class="tips">
<view class="tips_name">备注信息</view>
<view class="textarea_box">
<textarea placeholder="请输入备注信息" disabled="true" placeholder-class="font-size: 24upx" maxlength="-1" v-model="orderList.tips"></textarea>
{{ goods.createTime }}
</view>
</view>
<view class="tips margin0" v-if="goods.dispacherRemark || goods.financeRemark">
<view class="tips_name">退单原因</view>
<view class="textarea_box" v-if="goods.dispacherRemark">
<textarea disabled="true" placeholder-class="font-size: 24upx" maxlength="-1"
v-model="goods.dispacherRemark">
</textarea>
</view>
<view class="textarea_box" v-if="goods.financeRemark">
<textarea disabled="true" placeholder-class="font-size: 24upx" maxlength="-1"
v-model="goods.financeRemark">
</textarea>
</view>
</view>
<view class="tips">
<view class="tips_name">订单备注</view>
<view class="textarea_box">
<textarea disabled="true" placeholder-class="font-size: 24upx" maxlength="-1" v-model="goods.remark">
</textarea>
</view>
</view>
</view>
<view class="bottom_btn" >
<block v-if="status == 0">
<block v-if="goods.state == 0">
<view class="moneys">
合计: <text :style="'color:' + colors + ';'">{{orderList.sumprice}}</text>
合计: <text :style="'color:' + colors + ';'">{{goods.totalAmount}}</text>
</view>
<view class="btns" :style="'color:' + colors + ';border:1upx solid ' + colors + ';margin-right:20upx'" @tap="cencalOrder">
<view class="btns"
:style="'color:' + colors + ';border:1upx solid ' + colors + ';margin-right:20upx'"
@tap="changeOrderStatus(goods.state, 'cancel')">
取消订单
</view>
<view class="btns" :style="'background:' + colors + ';'">
<!-- <view class="btns" :style="'background:' + colors + ';'">
继续支付
</view>
</view> -->
</block>
<block v-if="status == 1">
<!-- <block v-if="goods.state == 1">
<view class="btns" :style="'color:' + colors + ';border:1upx solid ' + colors + ';margin-right:20upx'" @tap="onRefund">
申请退款
</view>
</block>
<block v-if="status == 2">
<view class="btns" :style="'color:' + colors + ';border:1upx solid ' + colors + ';margin-right:20upx'" @tap="onRefund">
</block> -->
<block v-if="goods.state == 2">
<!-- <view class="btns" :style="'color:' + colors + ';border:1upx solid ' + colors + ';margin-right:20upx'" @tap="onRefund">
申请退款
</view>
<view class="btns" :style="'background:' + colors + ';'">
</view> -->
<view class="btns"
@tap="changeOrderStatus(goods.state, 'ok')"
:style="'background:' + colors + ';'">
确认收货
</view>
</block>
<block v-if="status == 3">
<view class="btns shouhou" @click="jumpSale">退/</view>
<view class="btns" :style="'background:' + colors + ';margin-left:20upx;'">再次购买</view>
<block v-if="goods.state == 3">
<!-- <view class="btns shouhou" @click="jumpSale">退/</view> -->
<!-- <view class="btns" :style="'background:' + colors + ';margin-left:20upx;'">再次购买</view> -->
<view class="btns shouhou" @tap="onafterSale">退/</view>
</block>
<block v-if="status == 4">
<block v-if="goods.state == 4">
<view class="btns shouhou" @click="delOrder"></view>
</block>
</view>
@ -146,6 +177,8 @@
</template>
<script>
import { getSalesGoods, getUserInfo, setSalesGoodsItem } from '@/utils/auth'
import { editOrder, getCommits } from '@/api'
var app = getApp();
import loading from "../../commponent/public/loading";
export default {
@ -155,6 +188,9 @@ export default {
status: 0,
//
isShow: true,
goods: {
addr: ','
},
orderList: {
goods: [{
title: 'DUNKINDONUTS唐恩都乐美国甜甜圈6个礼盒装 随机搭配6款',
@ -202,6 +238,8 @@ export default {
colors: app.globalData.newColor,
status: status
});
setTimeout(() => {
this.setData({
isShow: false
@ -217,7 +255,10 @@ export default {
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
onShow: function () {
this.initGoodsData()
},
/**
* 生命周期函数--监听页面隐藏
@ -244,13 +285,123 @@ export default {
*/
onShareAppMessage: function () {},
methods: {
cencalOrder(item) {
goGoodsDetail(item) {
uni.navigateTo({
url: '/pages/views/goods/goodsDetails?id=' + item.goodsId
})
},
getCommits(goods) {
let s = [
{
"rule": "eq",
"type": "string",
"dictCode": "",
"val": getUserInfo().id,
"field": "userId"
},
{
"rule": "eq",
"type": "string",
"dictCode": "",
"val": goods.id,
"field": "orderId"
},
// {
// "rule": "eq",
// "type": "string",
// "dictCode": "",
// "val": getUserInfo().id,
// "field": "goodId"
// }
]
const params = {
pageNo:1,
pageSize: 100,
superQueryParams: s,
superQueryMatchType: 'and',
"column": "createTime",
order: "desc",
}
params.superQueryParams = encodeURI(JSON.stringify(s))
getCommits(params).then(res => {
const list = res.result.records.map(v => ({ id: v.id, goodsId: v.goodId }))
const orderDetailList = goods.orderDetailList.map(v => {
const idList = list.filter(vc => vc.goodsId === v.goodsId)
if (idList.length) {
v.commitId = idList[0].id
}
return v
})
goods.orderDetailList = orderDetailList
this.goods = goods
})
},
initGoodsData() {
const goods = getSalesGoods()
if (!goods) {
uni.reLaunch({
url: '/pages/views/tabBar/category'
})
}
this.getCommits(goods)
},
changeOrderStatus(state, type = 'ok') {
const stateObj = {
0: {
okState: 1,
okText: '',
cancelText: '是否取消该订单吗?',
cancelState: 5,
},
2: {
okText: '是否确认收货?',
okState: 3,
cancelText: '',
}
}
const title = stateObj[state][type + 'Text']
let that = this
uni.showModal({
title,
confirmColor:this.colors,
success: (res) => {
if(res.confirm){
that.goods.state = stateObj[state][type + 'State']
editOrder(that.goods).then(res => {
uni.showToast({
icon: 'none',
title: '操作成功'
})
uni.navigateBack(-1)
})
}
}
})
},
confirmOrder(item) {
},
cancelOrder(item) {
//
uni.showModal({
title:'确认要取消该订单吗?',
confirmColor:this.colors,
success: (res) => {
if(res.confirm){
item.state = 5
editOrder(item).then(res => {
uni.showToast({
icon: 'none',
title: '操作成功'
})
uni.navigateBack(-1)
})
console.log('取消成功')
}
}
@ -270,10 +421,7 @@ export default {
input.select(); //
document.execCommand('Copy'); //
document.body.removeChild(input); //
uni.showToast({
title:'复制成功~',
icon:'none'
})
this.$toast('复制成功')
// #endif
// #ifndef H5
uni.setClipboardData({
@ -288,13 +436,17 @@ export default {
// #endif
},
onafterSale(item){ //
this.$toast('功能开发中,敬请期待')
return
uni.navigateTo({
url:'/pages/views/order/afterType?goodData='+JSON.stringify(item)
})
},
onevaluate(item){ //
setSalesGoodsItem(item)
const id = item.commitId ? item.commitId : 0
uni.navigateTo({
url:'/pages/views/order/evaluate/evaluate?goodData='+JSON.stringify(item)
url:'/pages/views/order/evaluate/evaluate?id=' + id
})
},
jumpSale(){ //退
@ -574,6 +726,10 @@ page {
margin-bottom: 120upx;
padding-bottom: 20upx;
}
.tips.margin0 {
margin: 0;
color: var(--red);
}
.tips .tips_name{
font-size: 26upx;
font-weight: bold;

@ -20,7 +20,8 @@
{{ item.state | setStatus }}
</text>
</view>
<view v-for="(row, index2) in item.orderDetailList" :key="index2" class="top" @tap="jumpDetails(item)">
<view v-for="(row, index2) in item.orderDetailList" :key="index2" class="top"
@tap="jumpDetails(item)">
<image :src="row.url" mode="aspectFill"></image>
<view class="top_right">
<view class="order_name">{{row.goodsName}}</view>
@ -49,7 +50,7 @@
<!-- <view class="pay shouhou" @tap="onRefund(item)">退</view> -->
</block>
<block v-if="item.state == 3">
<!-- <view class="pay shouhou" :style="'color:' + colors + ';border-color:' + colors" @tap="jumpDetails(item)"></view> -->
<view class="pay shouhou" :style="'color:' + colors + ';border-color:' + colors" @tap="jumpDetails(item)"></view>
<view class="pay shouhou" @tap="jumpDetails(item)"></view>
</block>
<!-- <view class="pay shouhou" v-if="item.state == 4" @click="delOrder(item)"></view> -->
@ -72,7 +73,7 @@
import loading from "../../commponent/public/loading";
import navBar from '../../commponent/public/navBar.vue'
import { ORDER_NAVS } from '@/config/order.js'
import { getUserInfo } from '@/utils/auth';
import { getUserInfo, setSalesGoods } from '@/utils/auth';
export default {
data() {
return {
@ -87,7 +88,6 @@ import { getUserInfo } from '@/utils/auth';
},
filters: {
setStatus(value) {
console.log(value)
if (value == 0) {
return '待付款'
} else if (value == 1) {
@ -130,7 +130,7 @@ import { getUserInfo } from '@/utils/auth';
isShow: false
});
}, 600);
this.getOrderList(ORDER_NAVS[this.active].id)
},
/**
@ -141,7 +141,9 @@ import { getUserInfo } from '@/utils/auth';
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {},
onShow: function() {
this.getOrderList(ORDER_NAVS[this.active].id)
},
/**
* 生命周期函数--监听页面隐藏
@ -170,7 +172,7 @@ import { getUserInfo } from '@/utils/auth';
methods: {
onConfirmOrder(item) {
uni.showModal({
title:'确认要确认收货?',
title:'是否确认收货?',
confirmColor:this.colors,
success: (res) => {
if(res.confirm){
@ -229,14 +231,10 @@ import { getUserInfo } from '@/utils/auth';
this.getOrderList(item.id)
},
jumpDetails() { //
uni.showToast({
icon: "none",
title: "功能正在开发中,敬请期待"
})
return
jumpDetails(item) { //
setSalesGoods(item)
uni.navigateTo({
url: '/pages/views/order/orderDetails?status=' + this.active
url: '/pages/views/order/orderDetails?status='+ 3
});
},
cencalOrder(item) {

@ -135,6 +135,7 @@ export default {
colorModal: false
});
app.globalData.newColor = item.color;
app.globalData.themeObj = item
},
onexit() {
//退

@ -3,8 +3,9 @@
<!-- #ifdef APP-PLUS -->
<div class="status-bar" :style="{height:statusBarHeight+'px'}"></div>
<!-- #endif -->
<block v-if="cartList.length !== 0">
<view class="clearCart" :style="{top:showHeader==true?statusBarHeight+'px':'0upx'}" @click="clearInvalid"></view>
<block v-if="cartList.length > 0 ">
<view class="clearCart" :style="{top:showHeader==true?statusBarHeight+'px':'0upx'}"
@click="clearInvalid">购物车</view>
<!-- <view class="clearCart" :style="{color:colors,top:showHeader==true?statusBarHeight+'px':'0upx'}" @click="clearInvalid"></view> -->
<view class="cart_box">
@ -22,14 +23,14 @@
</view>
</view>
<view class="cover" @tap="jumpDetails(item,index)">
<image :src="item.selectSku.img" mode="aspectFill" v-if="item.selectSku"></image>
<image :src="item.img" mode="aspectFill" v-else></image>
<image :src="item.selectSku.url" mode="aspectFill" v-if="item.selectSku"></image>
<image :src="item.url" mode="aspectFill" v-else></image>
<text class="masks"></text>
<text class="mask" v-if="item.status == 1"></text>
</view>
<view class="right">
<view class="goods_name" @tap="jumpDetails(item,index)">
{{item.title}}
{{item.goodsName}}
</view>
<view class="sku">
<block v-if="item._selectedSku.length">
@ -46,12 +47,13 @@
{{ item.selectSku.money }}
</text>
<text class="price" v-else>
{{(Number(item.money) * item.number).toFixed(2)}}
{{(Number(item.price) * item.number).toFixed(2)}}
</text>
<view class="right_btn">
<view class="sub" @tap="onsub(item,index)" :style="'color:' + (item.num == 1?'#ccc':'')">-</view>
<view class="input">
<input :value="item.number" maxlength="2" disabled></input>
<input :value="item.number"
maxlength="2" disabled></input>
</view>
<view class="add" @tap="onadd(item,index)">+</view>
</view>
@ -159,16 +161,16 @@
})
return
}
let cart = getCart() || []
const cartList = getCart() || []
this.setData({
colors: app.globalData.newColor,
current: '99999',
cartList: cart,
cartList,
allCurrent: false,
sum: 0,
sumPrice: 0
});
setTabBarBadge(cart.length)
setTabBarBadge(cartList.length)
this.setAllCurrent(false)
},
@ -221,7 +223,6 @@
[datas]: dataList,
allCurrent: currentAll,
});
console.log(cartList)
resetCart(cartList)
this.getSumprice()
},
@ -260,7 +261,7 @@
onsub(item, index) {
// //
if (item.status == 1 || item.number <= 1) {
if (tem.number <= 1) {
return
}
let number = item.number - 1
@ -301,11 +302,8 @@
} else {
allCurrent = dataList.every(v => v.current)
}
this.setData({
cartList: dataList,
allCurrent: allCurrent,
});
this.cartList = dataList
this.allCurrent = allCurrent
this.getSumprice()
},
getSumprice() { //
@ -313,9 +311,9 @@
const list = this.cartList.filter(v => v.current)
list.forEach(v => {
if (v.selectSku) {
sumPrice += resetNum(v.selectSku.money * v.number)
sumPrice += resetNum(v.price * v.number)
} else {
sumPrice += resetNum(v.money * v.number)
sumPrice += resetNum(v.price * v.number)
}
})
@ -352,13 +350,8 @@
setTabBarBadge(this.cartList.length)
},
jumpDetails(item, index) {
if (item.status == 1 || this.lock) { //
return
}
let cartD = getCartDetails_goods_id(item.goods_id)
setGoodsDetails(cartD)
uni.navigateTo({
url: '/pages/views/goods/goodsDetails'
url: '/pages/views/goods/goodsDetails?id=' + item.id
});
},
settlement() { //

@ -1,5 +1,5 @@
<template>
<view class="category">
<view class="category " :class="['theme', themeObj.name]">
<!-- 搜索 -->
<!-- #ifdef APP-PLUS -->
<div class="status-bar" :style="{height:statusBarHeight+'px'}"></div>
@ -24,14 +24,16 @@
<scroll-view class="padding-sm" scroll-y scroll-with-animation style="width: calc(100% - 110px); height:calc(100vh - 140px)"
:scroll-into-view="'main-'+mainCur" @scroll="VerticalMain">
<view class="type_head">
<view class="type_head_item text-center text-xs" v-for="(type,index) in subPoiCategories"
:class="type.id==tabTypeCur?'type_head_item_cur':''" @tap="TabTypeSelect" :key="index":data-id="type.id">
<view class="type_head_item text-center text-xs"
v-for="(type,index) in subPoiCategories"
:class="type.id==tabTypeCur?'type_head_item_cur':''"
@tap="TabTypeSelect" :key="index":data-id="type.id">
<view class="">{{type.name}}</view>
</view>
</view>
<view class="type_good">
<goodList style="width: 100%; background-color: #FFFFFF;" :propsList = "cateGood" ></goodList>
<goodList :has-token="hasToken" style="width: 100%; background-color: #FFFFFF;" :propsList = "cateGood" ></goodList>
</view>
@ -45,7 +47,7 @@
import search from "../../commponent/public/search";
import goodList from '../../commponent/home/goodList';
import jsonData from "../../../json.js"
import { getCart, getToken } from '../../../utils/auth';
import { getCart, getToken } from '@/utils/auth';
import { setTabBarBadge } from '@/utils/util.js'
var app = getApp();
export default {
@ -66,7 +68,6 @@ var app = getApp();
bottoms: '100',
showHeader: false, //APPh5
classLevel: true, // true false
colors: "",
current: "",
scrollTop: "",
statusBarHeight: 20,
@ -74,7 +75,9 @@ var app = getApp();
currentTwo: 0,
currentThere: 0,
_goods: []
_goods: [],
hasToken: true,
themeObj: app.globalData.themeObj
};
},
@ -83,11 +86,7 @@ var app = getApp();
goodList
},
mounted() {
this.getGoodsList()
},
/**
* 生命周期函数--监听页面加载
*/
@ -96,8 +95,7 @@ var app = getApp();
this.showHeader = true //APP
this.bottoms = '0' //APP
// #endif
this.getGoodsList()
},
/**
@ -110,14 +108,15 @@ var app = getApp();
*/
onShow: function() {
if (getToken()) {
this.hasToken = true
const carts = getCart()
setTabBarBadge(carts.length)
} else {
this.hasToken = false
setTabBarBadge(0)
}
this.setData({
colors: app.globalData.newColor
});
this.themeObj = app.globalData.themeObj
},
/**

@ -79,7 +79,7 @@ export default {
coverTransition: '0s',
//
orderText: ORDER_NAVS.slice(1),
logList:getGoodsHistory(),
logList: [],
serverList: [{
name: '我的收藏',
icon: 'icon-shoucang',
@ -153,6 +153,7 @@ export default {
})
return
}
this.logList = getGoodsHistory()
let colors = app.globalData.newColor;
let oldcolor = this.colors;
let userdata = getUserInfo() || {};
@ -164,7 +165,7 @@ export default {
if (oldcolor !== colors) {
//
let config = getConfig();
let tabList = config.tabList;
let tabList = config.tabList || [];
uni.setTabBarStyle({
selectedColor: colors
});

@ -1,6 +1,6 @@
<template>
<view>
<view class="editaddress">
<view class="editaddress" :class="['theme', themeObj.name]">
<view class="content">
<view class="row">
<view class="nominal">收件人</view>
@ -23,10 +23,13 @@
</view>
<view class="row">
<view class="nominal" style="color: #999;margin-top: 10upx;">设为默认地址</view>
<view class="input switch"><switch :color="colors" style="transform:scale(0.8)" @change="switchChange" :checked="addressData.isDefault == 1"></switch></view>
<view class="input switch">
<switch
:color="themeObj.color"
style="transform:scale(0.8)" @change="switchChange" :checked="addressData.isDefault == 1"></switch></view>
</view>
</view>
<view class="save" @tap="addAddr"><view class="btn" :style="'background:' + colors">保存地址</view></view>
<view class="save" @tap="addAddr"><view class="btn" >保存地址</view></view>
<!-- 省市区选择 -->
<setcity :show="show" @sureSelectArea="onsetCity" @hideShow="onhideShow"></setcity>
</view>
@ -35,12 +38,12 @@
</template>
<script>
var app = getApp();
import setcity from "../../../commponent/public/setCity/nyz_area_picker";
import loading from "../../../commponent/public/loading";
import { addAddr, editAddr} from '@/api/index.js'
import { getUserInfo } from "@/utils/auth";
const app = getApp();
export default {
data() {
return {
@ -66,7 +69,8 @@ export default {
id:0
},
address: [],
isShow: true
isShow: true,
themeObj: app.globalData.themeObj
};
},
@ -133,18 +137,12 @@ export default {
addAddr() {
if ( this.address.length < 1 || !this.addressData.moreAddres || !this.addressData.recipient ||
!this.addressData.telephone) {
uni.showToast({
icon: 'none',
title: '请填写信息'
})
this.$toast('请填写信息')
return
}
const telReg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
if (!telReg.test(this.addressData.telephone)) {
uni.showToast({
icon: 'none',
title: '请填写正确手机号'
})
this.$toast('请填写正确手机号')
return
}
const params = {
@ -164,10 +162,8 @@ export default {
params.id = this.addressData.id
editAddr(params).then(res => {
if (res.result) {
uni.showToast({
icon: 'none',
title: '操作成功'
})
this.$toast('操作成功')
}
uni.navigateBack()
})
@ -176,10 +172,7 @@ export default {
addAddr(params).then(res => {
if (res.result) {
uni.showToast({
icon: 'none',
title: '操作成功'
})
this.$toast('操作成功')
}
uni.navigateBack()
})

@ -1,7 +1,6 @@
<template>
<!-- 我的足迹 -->
<view>
<navBar :showLeft="true" navTitle="浏览历史" bgColor="#f8f8f8" textcolor="#000" :leftBg="false"></navBar>
<view class="mycollection">
<view class="cart_box">
<view v-for="(item, index) in dataList" :key="index" class="cart_list">
@ -38,8 +37,8 @@
<script>
var app = getApp();
import loading from "../../commponent/public/loading";
import navBar from '../../commponent/public/navBar.vue'
import { getGoodsHistory } from '@/utils/auth';
import { getGoodsHistory } from '@/utils/auth';
export default {
data() {
return {
@ -51,7 +50,7 @@
components: {
loading,
navBar
},
props: {},
@ -107,7 +106,7 @@
jumpDetails(item,index) {
//
uni.navigateTo({
url: '/pages/views/goods/goodsDetails?id=' + item.skuId
url: '/pages/views/goods/goodsDetails?id=' + item.id
});
},
}
@ -116,6 +115,7 @@
<style scoped lang="scss">
.mycollection {
padding: 10upx 4%;
padding-top: 90upx;
}
.cart_box {

@ -1,16 +1,16 @@
<template>
<view>
<view class="myaddress">
<view class="myaddress" :class="['theme', themeObj.name]">
<view >
<view v-for="(item, index) in addressList" :key="index" class="order_address">
<view class="address_box">
<view class="weizhi_icon">
<text class="iconfont icon-dizhi" :style="'color:' + colors"></text>
<text class="iconfont icon-dizhi"></text>
</view>
<view @click="onsetAddress(item)">
<view class="center">
<!-- v-if="item.isDefault == 1" -->
<view class="moren">
<text class="iconfont icon-moren" :style="'color:' + colors"></text>
<text class="iconfont icon-moren"></text>
</view>
<view class="name">
<text class="text1">{{item.recipient}}</text>
@ -35,27 +35,29 @@
<nodata :colors="colors" title="暂无收货地址" v-if="addressList.length == 0"></nodata>
</view>
<view class="save">
<view class="btn" :style="'background:' + colors" @tap="addAddress"></view>
<view class="btn" @tap="addAddress"></view>
</view>
<loading v-if="isShow == true"></loading>
</view>
</template>
<script>
var app = getApp();
import { getAddrList, delAddr } from '@/api/index.js'
import loading from "../../commponent/public/loading";
import {
getUserInfo,
setAddress
} from '@/utils/auth.js'
const app = getApp();
export default {
data() {
return {
colors: '',
addressList: [],
isShow: true,
type:''
type:'',
themeObj: app.globalData.themeObj
};
},
@ -69,10 +71,10 @@
*/
onLoad: function(options) {
let type = options.type || ''
this.type = options.type || ''
this.setData({
colors: app.globalData.newColor,
type: type
});
setTimeout(() => {
this.setData({
@ -290,6 +292,7 @@
.save {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 120upx;
display: flex;

@ -1,2 +1,5 @@
//
$mycolor:#FF1929;
$mycolor:#FF1929;
.uni-system-preview-image {
z-index: 99999 !important;
}

@ -54,6 +54,7 @@ export function getConfig() {
if (config) {
return JSON.parse(config);
}
return null
}
/**
* 获取推荐人id
@ -78,7 +79,7 @@ export function setGoodsHistory(item) {
if (goodsLength) {
const hasGoods = goodsdata.some(v => v.id === item.id)
if (!hasGoods) {
goodsdata = goodsLength > 5 ? goodsdata.slice(0, goodsLength - 1) : goodsdata
goodsdata = goodsLength >= 20 ? goodsdata.slice(0, goodsLength - 1) : goodsdata
goodsdata.unshift(item)
const newValue = JSON.stringify(goodsdata);
uni.setStorageSync('goodsHistory', newValue);
@ -113,6 +114,7 @@ export function setGoodsData(value) {
return;
}
}
export function getGoodsData() {
let goodsdata = uni.getStorageSync('goodsdata');
@ -253,6 +255,42 @@ export function removeToaddress() { //删除取件地址
}
export function setSalesGoods(value) {
try {
let newValue = JSON.stringify(value);
uni.setStorageSync('SalesGoods', newValue);
} catch (e) {
return;
}
}
export function getSalesGoods() {
let GoodsDetails = uni.getStorageSync('SalesGoods');
if (GoodsDetails) {
return JSON.parse(GoodsDetails);
}
}
export function setSalesGoodsItem(value) {
try {
let newValue = JSON.stringify(value);
uni.setStorageSync('SalesGoodsItem', newValue);
} catch (e) {
return;
}
}
export function getSalesGoodsItem() {
let GoodsDetails = uni.getStorageSync('SalesGoodsItem');
if (GoodsDetails) {
return JSON.parse(GoodsDetails);
}
}
export function rmSalesGoodsItem() {
uni.removeStorageSync('SalesGoodsItem')
}
// 由于无法调取接口 点击商品进入详情只能把数据暂存在缓存内 然后详情页获取该数据渲染

@ -5,12 +5,19 @@
* .then(res=>{console.log(res)})
*/
import { getToken, removeToken } from "./auth";
const baseUrl = 'http://47.100.1.234:8080/jeecg-boot';
const baseUrl = 'http://47.100.35.222:8080/jeecg-boot';
async function request(mehtod, params, type = 'GET') {
//创建一个名为request请求的方法函数
const token = getToken()
// if (!token) {
// uni.navigateTo({
// url:'/pages/login/index1'
// })
// return
// }
let header = {
//设置请求头信息
'X-Access-Token': getToken(),
'X-Access-Token': token,
'X-Requested-With': 'XMLHttpRequest',
"Accept": "application/json",
"Content-Type": "application/json; charset=UTF-8"
@ -23,7 +30,6 @@ async function request(mehtod, params, type = 'GET') {
};
let promise = new Promise((resolve, reject) => {
uni.request(http).then(res => {
console.log(res)
let newdata = res[1].data; // if (newdata.code == 403) {
if (newdata == -1) {
//如果错误码为 -1 提示
@ -34,6 +40,11 @@ async function request(mehtod, params, type = 'GET') {
}
resolve(res[1].data);
}).catch(err => {
if (err.statusCode === 401) {
uni.redirectTo({
url: '/pages/login/index1?status=' + 1
})
}
reject(err);
console.log(err);
});

@ -1,4 +1,5 @@
const formatTime = date => {
import CONFIG from '@/config'
export const formatTime = date => {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
@ -8,11 +9,11 @@ const formatTime = date => {
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':');
};
const formatNumber = n => {
export const formatNumber = n => {
n = n.toString();
return n[1] ? n : '0' + n;
};
function resetNum(num, type = 'first', fixNum = 4) {
export function resetNum(num, type = 'first', fixNum = 4) {
const pow = Math.pow(10, fixNum);
if (type === 'end') {
return (Number(num) / pow).toFixed(2)
@ -20,7 +21,7 @@ function resetNum(num, type = 'first', fixNum = 4) {
return Number(num) * pow
}
function setTabBarBadge (num, index = 1) {
export function setTabBarBadge (num, index = 1) {
if (num < 1) {
uni.removeTabBarBadge({
index
@ -33,8 +34,26 @@ function setTabBarBadge (num, index = 1) {
text: String(num)
});
}
module.exports = {
formatTime: formatTime,
resetNum,
setTabBarBadge
};
export function toast(message = 'message', duration = 2000) {
uni.showToast({
title: message,
icon: 'none',
duration
})
}
export function getFileList (url) {
const imgType = ['.png', '.jpeg', '.jpg','.xbm','.tif','.ico','.tiff','.gif','.svg','.webp','.bmp','.pjp','.apng','.pjpeg','.avif']
const urls = url ? url.split(',') : []
return urls.map(v => {
const isImg = imgType.some(item => v.includes(item))
const type = isImg ? 'img' : 'video'
console.Console
return {
type,
_url: v,
url: CONFIG.imgUrl + v
}
})
}
Loading…
Cancel
Save