Commit 08cc844b authored by 罗超's avatar 罗超

新增订单确认页面

parent 14c25d3b
......@@ -100,7 +100,8 @@ export default {
<style lang="scss">
@import "uview-ui/index.scss";
swiper{
height: unset;
}
</style>
</style>
\ No newline at end of file
@font-face {
font-family: 'iconfont';
/* project id 1830471 */
src: url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.eot');
src: url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.eot?#iefix') format('embedded-opentype'), url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.woff2') format('woff2'), url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.woff') format('woff'), url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.ttf') format('truetype'), url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.svg#iconfont') format('svg');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.iconweibiaoti-:before {
content: "\e607";
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
class="actionsheet"
:style="{ 'padding-bottom': bian ? '28px' : '0px' }"
>
<view class="item" @click="setFavorite" style="width:36px;">
<view class="item" style="width:36px;" @click="goCart">
<view style="width: 22px; margin: auto;">
<u-icon name="cart-o" size="44" :color="mc"></u-icon>
</view>
......@@ -99,9 +99,13 @@ export default {
this.favorStatus = this.favorite;
},
methods: {
goCart(){
uni.redirectTo({
url: '/pages/cart/cart'
});
},
setFavorite() {
let h=this.apiheader()
console.log(h)
this.request(
{
url: "",
......
......@@ -113,7 +113,7 @@ export default {
skued: {
type: Object,
default: {},
}
},
},
data() {
......@@ -153,14 +153,12 @@ export default {
this.g = this.good;
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.skuObj=this.skued.id?this.skued:null
if(this.skuObj){
this.skuObj = this.skued.id ? this.skued : null;
if (this.skuObj) {
this.goodimage = this.skuObj.pic_url || this.g.cover_pic;
this.goodprice = (
parseFloat(this.skuObj.price) * 1
).toFixed(2);
this.goodamount = this.skuObj.stock;
}else{
this.goodprice = (parseFloat(this.skuObj.price) * 1).toFixed(2);
this.goodamount = this.skuObj.stock;
} else {
this.goodimage = this.g.cover_pic;
this.goodprice = this.g.price_min;
this.goodamount = this.g.goods_stock;
......@@ -168,28 +166,62 @@ export default {
this.bian = this.$utils.is_biang;
this.btn1.background = this.secondary;
this.btn2.background = this.mc;
if(this.optionType==2){
this.btn1.borderRadius="40px 0 0 40px"
this.btn2.borderRadius="0 40px 40px 0"
if (this.optionType == 2) {
this.btn1.borderRadius = "40px 0 0 40px";
this.btn2.borderRadius = "0 40px 40px 0";
}
console.log(this.skued)
console.log(this.skued);
this.g.attr_groups.forEach((x) => {
if(!this.skuObj){
if (!this.skuObj) {
(x.checkId = 0), (x.checkName = x.attr_group_name);
}else{
let sign=`:${this.skuObj.sign_id}:`
x.attr_list.forEach(y=>{
if(sign.indexOf(`:${y.attr_id}:`)!=-1){
x.checkId=y.attr_id
x.checkName=y.attr_name
} else {
let sign = `:${this.skuObj.sign_id}:`;
x.attr_list.forEach((y) => {
if (sign.indexOf(`:${y.attr_id}:`) != -1) {
x.checkId = y.attr_id;
x.checkName = y.attr_name;
}
})
});
}
});
this.formatDisableSku();
this.formatChosenTips();
},
methods: {
joinCar() {
let h = this.apiheader();
h['content-type']='application/x-www-form-urlencoded'
if (this.skuObj && this.skuObj.id) {
this.request(
{
url: "",
data: {
r: 'api/cart/add',
goods_id: this.g.id,
attr: this.skuObj.id,
num: this.gc == 0 ? 1 : this.gc,
},
header: h,
method: "POST",
},
(res) => {
uni.showToast({
title: "加入购物车成功",
icon: "success",
duration: 2000,
});
this.popupClose();
}
);
} else {
uni.showToast({
title: '请选择商品',
position:"bottom",
icon:"none",
duration: 2000
});
}
},
close() {
this.popupClose();
},
......@@ -240,7 +272,7 @@ export default {
});
if (sign.length == this.g.attr_groups.length - 1) {
this.formatDisable(sign)
this.formatDisable(sign);
} else if (sign.length == this.g.attr_groups.length) {
let t = sign.join(":");
let len = -1;
......@@ -253,28 +285,28 @@ export default {
this.g.attr_groups[len].checkId = 0;
this.g.attr_groups[len].checkName = this.g.attr_groups[len].attr_name;
this.formatDisableSku();
}else{
this.formatDisable(sign.splice(sign.length-1,1))
} else {
this.formatDisable(sign.splice(sign.length - 1, 1));
}
}
},
formatDisable(sign){
formatDisable(sign) {
this.notStockGood = [];
this.g.attr.forEach((x) => {
if (x.stock == 0) {
let t = x.sign_id.split(":");
let t1 = [];
t.forEach((x) => {
if (sign.indexOf(x) == -1) {
t1.push(x);
}
});
if (t1.length == 1) {
this.notStockGood.push(parseInt(t1[0]));
this.g.attr.forEach((x) => {
if (x.stock == 0) {
let t = x.sign_id.split(":");
let t1 = [];
t.forEach((x) => {
if (sign.indexOf(x) == -1) {
t1.push(x);
}
});
if (t1.length == 1) {
this.notStockGood.push(parseInt(t1[0]));
}
});
this.$forceUpdate();
}
});
this.$forceUpdate();
},
formatSku() {
let sign = "";
......@@ -298,7 +330,7 @@ export default {
},
// 弹窗关闭
popupClose() {
this.$emit("close",this.skuObj);
this.$emit("close", this.skuObj);
this.$emit("input", false);
},
valChange(e) {
......
<template>
<view class="u-field" :class="{'u-field-border': itemIndex > 0 }">
<view class="u-field" :style="{'padding':padding}" :class="{'u-field-border': itemIndex > 0 }">
<view class="u-field-inner" :class="[type == 'textarea' ? 'u-textarea-inner' : '', 'u-label-postion-' + labelPosition]">
<view class="u-label" :class="[required ? 'u-required' : '']" :style="{
justifyContent: justifyContent,
......@@ -125,6 +125,10 @@ export default {
type: [String, Boolean],
default: ''
},
padding:{
type:String,
default:"20px 28px"
},
placeholder: String,
placeholderStyle: String,
focus: Boolean,
......
......@@ -2,25 +2,27 @@
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"pages": [
{
"path": "pages/index/index"
},
{
"path": "pages/user-center/user-center"
},
{
"path": "pages/cart/cart"
},
{
"path": "pages/cats/cats"
},
{
"pages": [{
"path": "pages/order-submit/order-submit"
},
{
"path": "pages/goods/goods"
},
{
"path": "pages/goods/comment-list"
},
{
"path": "pages/index/index"
},
{
"path": "pages/user-center/user-center"
},
{
"path": "pages/cart/cart"
},
{
"path": "pages/cats/cats"
},
{
"path": "pages/webbox/webbox"
},
......
This diff is collapsed.
<template>
<div v-if="!isloading">
<search :styleStr="searchStyle"></search>
<div :style="{'height':contentHeight+'px'}" style="voerflow:hidden;overflow-y:auto;">
<style1 v-if="cstyle.cat_style==1" :d="types" :h='(navHeight+54)'></style1>
<style2 v-if="cstyle.cat_style==2" :d="types" :h='(navHeight+54)'></style2>
<style3 v-if="cstyle.cat_style==3" :d="types" :h='(navHeight+54)'></style3>
<style4 v-if="cstyle.cat_style==5" :d="types" :h='(navHeight+54)'></style4>
<style5 v-if="cstyle.cat_style==6" :d="types" :h='(navHeight+54)'></style5>
<style6 v-if="cstyle.cat_style==4" :d="types" :h='(navHeight+54)'></style6>
<style7 v-if="cstyle.cat_style==7" :d="types" :h='(navHeight+54)'></style7>
<style8 v-if="cstyle.cat_style==8" :d="types" :h='(navHeight+54)'></style8>
<style9 v-if="cstyle.cat_style==9" :d="types" :h='(navHeight+54)'></style9>
<style10 v-if="cstyle.cat_style==10" :d="types" :h='(navHeight+54)'></style10>
<style11 v-if="cstyle.cat_style==11" :d="types" :h='(navHeight+54)'></style11>
<div
:style="{ height: contentHeight + 'px' }"
style="voerflow: hidden; overflow-y: auto;"
>
<style1
v-if="cstyle.cat_style == 1"
:d="types"
:h="(navHeight+54)"
></style1>
<style2
v-if="cstyle.cat_style == 2"
:d="types"
:h="(navHeight+54)"
></style2>
<style3
v-if="cstyle.cat_style == 3"
:d="types"
:h="(navHeight+54)"
></style3>
<style4
v-if="cstyle.cat_style == 5"
:d="types"
:h="(navHeight+54)"
></style4>
<style5
v-if="cstyle.cat_style == 6"
:d="types"
:h="(navHeight+54)"
></style5>
<style6
v-if="cstyle.cat_style == 4"
:d="types"
:h="(navHeight+54)"
></style6>
<style7
v-if="cstyle.cat_style == 7"
:d="types"
:h="(navHeight+54)"
></style7>
<style8
v-if="cstyle.cat_style == 8"
:d="types"
:h="(navHeight+54)"
></style8>
<style9
v-if="cstyle.cat_style == 9"
:d="types"
:h="(navHeight+54)"
></style9>
<style10
v-if="cstyle.cat_style == 10"
:d="types"
:h="(navHeight+54)"
></style10>
<style11
v-if="cstyle.cat_style == 11"
:d="types"
:h="(navHeight+54)"
></style11>
</div>
<tabbars></tabbars>
</div>
......@@ -48,8 +95,8 @@ export default {
},
types: [],
changeHeight: 0,
contentHeight:0,
cstyle:{}
contentHeight: 0,
cstyle: {},
};
},
components: {
......@@ -65,7 +112,7 @@ export default {
style8,
style9,
style10,
style11
style11,
},
onLoad() {
this.navHeight = this.$navHeight - 2;
......@@ -85,7 +132,7 @@ export default {
let currentPages = getCurrentPages();
let c = this.$uiConfig.is_bang ? 80 : 52;
this.contentHeight = this.$utils.calcContentHeight(c);
console.log(this.contentHeight)
console.log(this.contentHeight);
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
......@@ -95,6 +142,9 @@ export default {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
this.init();
uni.showNavigationBarLoading();
},
......@@ -121,7 +171,7 @@ export default {
}
});
this.isloading = false;
uni.hideNavigationBarLoading()
uni.hideNavigationBarLoading();
}
);
},
......
<template>
<view class="comment-list" v-if="commentCount && commentCount.length > 0">
<u-tabs
name="name"
:list="commentCount"
:is-scroll="false"
:active-color="mc"
:current="current"
@change="tabsChange"
></u-tabs>
<view class="comment-details" style="heigh: calc(100% - 40px);" v-if="comments.length>0">
<scroll-view
:scroll-y="true"
@scrolltolower="lower"
:enable-back-to-top="true"
:enable-flex="true"
style="height: 100%; padding-bottom: 0px;"
>
<view class="comment">
<view class="content" v-for="(x, i) in comments" :key="i">
<view class="u-box">
<view class="user">
<u-avatar :src="x.avatar" :size="50"></u-avatar>
<text style="margin-left: 10px;">{{ x.nickname }}</text>
</view>
<view class="timer">{{ x.time }}</view>
</view>
<view class="ucontent">{{ x.content }}</view>
<view class="imagebox" v-for="(y, yi) in x.formatPic" :key="yi">
<view
class="item"
v-for="(z, zi) in y"
:key="zi"
:style="{ 'max-width': yi == 0 ? 'unset' : '31.9%' }"
>
<view class="scal" @click="previewImage(z,x.pic_url)">
<image :src="z" mode="aspectFill" class="image" />
<view
class="more"
v-if="
x.pic_url.length > 4 &&
(yi + 1) * (zi + 1) == x.pic_url.length
"
>
<view style="width: 100%;">
<view class="big">5图</view>\n\r
<view class="small">查看全部</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<u-loadmore
:status="status"
:load-text="loadText"
:font-size="24"
:margin-top="20"
:margin-bottom="20"
bg-color="#fff"
/>
</scroll-view>
</view>
<u-empty
text="没有找到相关评论"
mode="news"
v-else
></u-empty>
</view>
</template>
<script>
export default {
data() {
return {
current: 0, // tabs组件的current值,表示当前活动的tab选项
page: 1,
pageCount: 0,
id: 0,
comments: [],
commentCount: [],
loading: false,
mc: "",
pageTitle: "全部评论",
status: "loadmore",
isover: false,
loadText: {
loadmore: "轻轻上拉,加载更多",
loading: "努力加载中",
nomore: "没有更多评论了",
},
};
},
onLoad(option) {
uni.showNavigationBarLoading();
this.id = option.id || 46942;
this.mc = this.$uiConfig.mainColor;
this.init();
this.initPage();
},
methods: {
previewImage(i,images) {
uni.previewImage({
urls: images,
current: i,
longPressActions: {
itemList: ["发送给朋友", "保存图片", "收藏"],
success: function (data) {
console.log(
"选中了第" +
(data.tapIndex + 1) +
"个按钮,第" +
(data.index + 1) +
"张图片"
);
},
fail: function (err) {
console.log(err.errMsg);
},
},
});
},
initPage() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
init() {
this.isover = false;
this.loading = true;
this.showLoading = this.page != 1;
this.request(
{
url: "",
data: {
r: "api/goods/comments-list",
goods_id: this.id,
page: this.page,
status: this.commentCount.length>0?this.commentCount[this.current].index:0,
},
},
(res) => {
this.comments = res.data.comments;
this.comments.forEach((x) => {
x.formatPic = this.formatPic(x.pic_url);
});
//TODO 缺陷待处理
this.commentCount = res.data.comment_count;
this.pageCount = Math.ceil(
parseFloat(this.commentCount[0].count) / 10.0
);
this.commentCount.forEach((x) => {
x.name = x.name + "(" + x.count + ")";
});
this.showLoading = true;
if (this.pageCount == 1) {
this.isover = true;
this.status = "nomore";
} else {
this.status = "loadmore";
}
this.loading = false;
uni.hideNavigationBarLoading();
}
);
},
formatPic(pics) {
let arr = [];
let temp = [];
pics.forEach((x, i) => {
temp.push(x);
if (i == 2) {
arr.push(temp);
temp = [];
} else if (i == 5) {
arr.push(temp);
temp = [];
} else if (i == pics.length - 1) {
arr.push(temp);
}
});
return arr;
},
tabsChange(index) {
this.current = index;
this.init()
this.page=1
},
lower(e) {
if (this.page < this.pageCount) {
if (!this.loading) {
this.status = "loading";
this.page++;
this.init();
}
} else {
this.isover = true;
this.status = "nomore";
}
},
},
};
</script>
<style>
.comment-list {
width: 100vw;
height: 100vh;
overflow: hidden;
}
.comment-list .comment-details {
height: calc(100% - 40px);
padding: 10px 0 0 0;
}
.comment-list .comment-details .comment {
/* margin: 10px 0;
background: #fff;
padding: 10px; */
}
.comment-list .comment-details .comment .chead {
padding-bottom: 10px;
border-bottom: 1px solid #f1f1f1;
}
.comment-list .comment-details .comment .content {
display: flex;
flex-direction: column;
margin-bottom: 10px;
padding: 10px;
background: #fff;
}
.comment-list .comment-details .comment .content .u-box {
display: flex;
margin-bottom: 10px;
align-items: center;
}
.comment-list .comment-details .comment .content .u-box .user {
flex: 1;
font-size: 12px;
color: gray;
align-items: center;
display: flex;
}
.comment-list .comment-details .comment .content .u-box .timer {
font-size: 12px;
color: gray;
text-align: right;
flex: 1;
}
.comment-list .comment-details .comment .content .u-box .ucontent {
font-size: 12px;
color: #000;
margin-top: 10px;
}
.comment-list .comment-details .comment .content .imagebox {
display: flex;
/* justify-content:space-evenly; */
margin-right: -5px;
margin-bottom: -5px;
margin-top: 5px;
/* flex-wrap: wrap; */
}
.comment-list .comment-details .comment .content .imagebox .item {
flex: 1;
max-width: 70vw;
margin-right: 5px;
margin-bottom: 5px;
min-width: 31.9%;
}
.comment-list .comment-details .comment .content .imagebox .item .scal {
width: 100%;
padding-bottom: 100%;
height: 0;
position: relative;
overflow: hidden;
}
.comment-list .comment-details .comment .content .imagebox .item .scal .image {
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 1;
height: 100%;
}
.comment-list
.comment-details
.comment
.content
.imagebox
.item:first-child
.scal {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.comment-list
.comment-details
.comment
.content
.imagebox
.item:last-child
.scal {
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
.comment-list .comment-details .comment .content .imagebox .item .scal .more {
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 2;
height: 100%;
background: rgba(0, 0, 0, 0.5);
color: #fff;
display: flex;
align-items: center;
}
.comment-list
.comment-details
.comment
.content
.imagebox
.item
.scal
.more
.big {
font-size: 18px;
font-weight: 500;
text-align: center;
margin-bottom: 5px;
}
.comment-list
.comment-details
.comment
.content
.imagebox
.item
.scal
.more
.small {
font-size: 14px;
text-align: center;
}
</style>
......@@ -133,6 +133,7 @@
:show-split="false"
:title="`商品评价(${comments.comments.length})`"
sub-title="查看更多"
@click="clickCommentHandler"
font-size="24"
></u-section>
</view>
......@@ -225,6 +226,7 @@ export default {
ot: 0,
currentSku: {},
isExsitGoods: true,
pageTitle:"商品详情"
};
},
components: {
......@@ -234,12 +236,33 @@ export default {
auth,
},
onLoad(option) {
this.id = option.id ? option.id : 59512; //40887 59512
this.id = option.id ? option.id : 46942; //40887 59512 46942
this.init();
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.initPage()
},
methods: {
initPage() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
clickCommentHandler(){
uni.navigateTo({
url: '/pages/goods/comment-list?id='+this.id
});
},
init() {
this.loading = true;
this.request(
......
This diff is collapsed.
......@@ -5,7 +5,7 @@ export default {
Vue.prototype.request = function(param, success, failed) {
//网络请求
uni.request({
url: this.host + "&r="+ param.data.r,
url: this.host + "&r=" + param.data.r,
method: param.method || "GET",
header: param.header || {
'content-type': "application/json"
......@@ -38,9 +38,9 @@ export default {
'X-Access-Token': '_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr',
'X-App-Platform': 'wxapp',
'X-App-Version': '4.2.47',
'X-Form-Id-List': [],
'X-Form-Id-List': '[]',
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 19992,
'X-User-Id': '19992',
'content-type': "application/json"
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment