Merge branch 'sit-Carl' of gitee.com:carl_Ming_1/smart-admin into sit-Leung

This commit is contained in:
Admin 2022-01-22 07:24:35 +00:00 committed by Gitee
commit 791bca1277
6 changed files with 793 additions and 360 deletions

View File

@ -73,9 +73,7 @@ export const postCourseId = (productCode,buyCount,memberId, mobile,productImg,pr
* 是否存在购物车
*/
export const isexistCart = (id, pet,address) => {
var data = {
memberId: id,
}
var data = { }
return fetch('getCartProductInfo?memberId='+id,data,'POST')
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,281 @@
<template>
<div>
<div class="usercontend">
<div class="rc-max-width--xl">
<h2>{{ title }}</h2>
<div class="rc-max-width--xl rc-people">
<span>收货人:</span>
<input
type="text"
placeholder="请输入收货人姓名"
v-model="userpeople"
/>
</div>
<div class="rc-max-width--xl rc-phone">
<span>手机号码:</span>
<input
type="text"
placeholder="请输入11位手机号码"
v-model="tel"
:error-message="usertel"
/>
</div>
<div class="rc-max-width--xl rc-address">
<span>所在地区:</span>
<!-- <input type="text" placeholder="请选择所在地区"> -->
<addressInput
@getmenu="onGetMenu"
@closeDialog="handleClose1"
:dialogInfo1="dialogInfo1"
:defaultValues="defaultValues"
></addressInput>
</div>
<div class="rc-max-width--xl rc-useaddress">
<span>详细地址:</span>
<!-- <input
type="text"
placeholder="小区、门牌号等"
class="userinput"
/> -->
<textarea
rows="10"
v-model="alladdress"
cols="30"
placeholder="请输入详细地址"
></textarea>
</div>
</div>
</div>
<div class="rc-button">
<span @click="openclose()">取消</span>
<em @click="register()">确认</em>
</div>
<!-- <div class="rc-button">
<div class="rc-footbutton" @click="onAdd()">
<span>新增收货地址</span>
</div>
</div> -->
</div>
</template>
<script>
import addressInput from "~/components/addressInput.vue";
import { memberAddress } from "../ajax/getData";
export default {
data() {
return {
title: "新增收货地址",
defaultValues: [],
chosenAddressId: "1",
usermessage: null,
checked: true,
tel: "",
id: "",
alladdress: "",
userid: null,
usermessage: null,
dialogInfo1: false,
userpeople: "",
provinceId: "",
cityId: "",
districtId: "",
list: [
{
id: 1,
name: "张三",
tel: "13000000000",
address: "浙江省杭州市西湖区文三路 138 号",
isDefault: true,
},
{
id: 2,
name: "李四",
tel: "1310000000",
address: "浙江省杭州市拱墅区莫干山路 50 号",
},
{
id: 3,
name: "李四",
tel: "1310000000",
address: "浙江省杭州市拱墅区莫干山路 50 号",
},
],
};
},
props: ["editAddressData"],
methods: {
onGetMenu(values) {
// console.log(values, +"111111");
// let user = values[2].id;
// user = user.split("-");
if (this.id == "") {
this.provinceId = values[0].id;
this.cityId = values[1].id;
this.districtId = values[2].id;
} else {
let user = values[2].id;
user = user.split("-");
this.provinceId = user[0];
this.cityId = user[1];
this.districtId = user[2];
}
},
handleClose1() {
this.dialogInfo1 = false;
},
register() {
console.log(this.tel);
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
this.$message({
type: "warning",
message: "手机号码输入有误",
});
return;
} else if (this.alladdress === "") {
this.$message({
type: "warning",
message: "请输入详细地址",
});
return;
} else if (this.userpeople === "") {
this.$message({
type: "warning",
message: "请输入姓名",
});
return;
} else if (this.provinceId === "") {
this.$message({
type: "warning",
message: "请选择省区",
});
return;
} else if (this.cityId === "") {
this.$message({
type: "warning",
message: "请选择市区",
});
return;
} else if (this.districtId === "") {
this.$message({
type: "warning",
message: "请选择详细的区域",
});
return;
} else {
this.editaddress();
}
},
openclose() {
this.$emit("isClose", false);
},
//
async editaddress(item) {
let useradd = {
memberId: this.userid,
detailAddress: this.alladdress,
recipient: this.userpeople,
recipientPhone: this.tel,
provinceId: this.provinceId,
cityId: this.cityId,
districtId: this.districtId,
};
if (this.id != "") useradd["id"] = this.id;
let saveType = this.editAddressData.saveType ? "update" : "add";
let res = await memberAddress(saveType, useradd);
if (res.msg == "SUCCESS") {
let typemess = saveType == "update" ? "修改地址成功" : "地址添加成功";
this.$message({
type: "warning",
message: typemess,
});
this.$emit("isClose", false);
} else {
this.$message({
type: "warning",
message: res.msg,
});
}
},
editInfo() {
if (this.editAddressData.saveType == "edit") {
this.title = "修改收货地址";
this.tel = this.editAddressData.tel;
this.alladdress = this.editAddressData.detailAddress;
this.userid = this.editAddressData.memberId;
this.userpeople = this.editAddressData.name;
this.provinceId = this.editAddressData.provinceId;
this.cityId = this.editAddressData.cityId;
this.districtId = this.editAddressData.districtId;
this.defaultValues = [
{
id: this.provinceId,
name: this.editAddressData.provinceName,
},
{
id: this.cityId,
name: this.editAddressData.cityName,
},
{
id: this.districtId,
name: this.editAddressData.districtName,
},
];
}
},
},
components: {
addressInput,
},
computed: {
usertel() {
if (this.tel === "") {
return "";
} else if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel)) {
return "手机号格式错误";
} else {
return "";
}
},
},
created() {
this.title =
this.editAddressData.saveType == "edit" ? "修改收货地址" : "新增收货地址";
this.tel = this.editAddressData.tel;
this.alladdress = this.editAddressData.detailAddress;
this.userid = this.editAddressData.memberId;
this.userpeople = this.editAddressData.name;
this.provinceId = this.editAddressData.provinceId;
this.cityId = this.editAddressData.cityId;
this.districtId = this.editAddressData.districtId;
this.defaultValues = [
{
id: this.provinceId,
name: this.editAddressData.provinceName,
},
{
id: this.cityId,
name: this.editAddressData.cityName,
},
{
id: this.districtId,
name: this.editAddressData.districtName,
},
];
},
mounted() {
this.usermessage = JSON.parse(localStorage.getItem("userInfo"));
this.userid = this.usermessage.data.id;
this.id = this.editAddressData.id;
},
};
</script>
<style lang="less" scoped >
@import url("../assets/css/global.less");
@import url("../assets/css/addaddress.less");
</style>

View File

@ -184,6 +184,8 @@ ul li ol li em strong i {
.rc-image {
border: 1px solid #d8d8d8;
margin-right: 20px;
width: 96px;
height: 96px;
img {
width: 96px;
@ -375,21 +377,38 @@ ul li ol li em strong i {
.diallog_width {
width: 100%;
max-width: 440px;
max-width: 920px;
margin: 0 auto;
.el-dialog {
width: 100%;
}
}
.el-dialog__header{
.el-dialog__header {
color: #e1001a;
}
//手机端
@media screen and (max-width: 768px) {
.settlement {
padding-top: 0;
.popnewaddr{
position: absolute;
bottom: -14px;
left: 0;
width: 100%;
.btn{
display: block;
background: #e2001a;
line-height: 48px;
text-align: center;
color: white;
font-size: 16px;
border-radius: 30px;
}
}
.diallog_width {
width: 100%;
}
.inline {
@ -401,72 +420,101 @@ ul li ol li em strong i {
}
.pop_list {
p{ padding: 0; margin: 0; line-height: 180%;}
p {
padding: 0;
margin: 0;
line-height: 180%;
}
.mypersonal {
border-bottom: 1px solid #d8d8d8;
padding: 15px 0;
}
input,.el-icon-edit{
input,
.el-icon-edit {
margin-top: 20px;
}
}
.rc-main {
.address-list {
display: contents;
.settlement {
.rc-main {
padding-top: 0;
.mypersonal {
width: 100%;
height: auto;
display: none;
border: none;
padding: 0;
.rc-usermain {
&.active {
display: block;
h3,
p {
padding: 0;
margin: 0;
}
.rc-usercenter h3 {
margin-top: 0;
}
}
}
.rc-main {
width: 100%;
.address-list {
display: contents;
.mypersonal {
width: 100%;
height: auto;
display: none;
border: none;
padding: 0;
.arrow_ph {
&.active {
display: block;
border: none;
.arrow_ph {
display: block;
}
.edit {
display: none;
}
}
.edit {
display: none;
&.add {
// display: block;
}
}
}
&.add {
// display: block;
.rc-usermain {
.rc-right {
display: table
}
}
}
.rc-usermain {
.rc-right {
display: table
.rc-merchandise {
padding: 15px 0 120px;
ul {
float: none;
width: 100%;
}
}
}
.rc-merchandise {
padding: 15px 0 120px;
ul {
float: none;
width: 100%;
}
}
.rc-foot {
.rc-foo {
display: flex;
justify-content: space-around;
flex-direction: row;
align-items: self-end;
position: fixed;
bottom: 0;
background: #fff;
width: 100%;
padding: 10px;
.rc-foot {
.rc-foo {
display: flex;
justify-content: space-around;
flex-direction: row;
align-items: self-end;
position: fixed;
left: 0;
bottom: 0;
background: #fff;
width: 100%;
padding: 10px;
}
}
}
}

View File

@ -1,8 +1,9 @@
<template>
<div class="settlement">
<Myheader></Myheader>
<div class="rc-main">
<tabs></tabs>
</div>
<div class="rc_contline"></div>
<div class="rc-main">
<div class="address-list">
@ -110,17 +111,16 @@
width="'100%"
title="选择收货地址"
>
<div class="tc dl_cont">
<div class="tc dl_cont" style="padding-bottom: 50px;position: relative;">
<div class="pop_list">
<el-row
class="mypersonal"
v-for="(item, index) in useraddress"
:key="index"
:class="item.isDefault ? 'active' : ''"
@click="selectAddress(item)"
>
<el-col :span="4"
><input type="checkbox" v-model="item.checked"
><input type="checkbox" v-model="item.checked" @click="selectPopAddress(item)"
/></el-col>
<el-col :span="16" class="tl">
<div >
@ -130,9 +130,12 @@
<p> {{ item.address }}</p>
</el-col>
<el-col :span="4">
<i class="el-icon-edit"></i>
<i @click="editAddress(item)" class="el-icon-edit"></i>
</el-col>
</el-row>
<div class="popnewaddr">
<span class="btn" @click="addAddress">新增收货地址</span>
</div>
</div>
</div>
</el-dialog>
@ -143,7 +146,7 @@
import Myheader from "~/components/header.vue";
import { userin, memberAddress, generateOrderWX } from "../../ajax/getData";
import tabs from "@/components/tabs.vue";
import myAddress from "../address/address.vue";
import myAddress from "~/components/address.vue";
import itemMixin from "../../../smart-admin-web/src/components/main/components/side-menu/item-mixin";
export default {
@ -215,8 +218,12 @@ export default {
tel: item.recipientPhone,
detailAddress: item.detailAddress,
id: item.id,
city: item.cityName,
districtId: item.districtName,
cityId: item.cityId,
districtId: item.districtId,
provinceId:item.provinceId,
provinceName: item.provinceName,
cityName: item.cityName,
districtName: item.districtName,
saveType: "edit",
};
this.dialogAdd = true;
@ -229,7 +236,20 @@ export default {
this.useraddress.forEach((item) => {
if (item.id == cur.id) {
item.isDefault = true;
item.checked=true
} else {
item.checked=false
item.isDefault = false;
}
});
},
selectPopAddress(cur) {
this.useraddress.forEach((item) => {
if (item.id == cur.id) {
item.isDefault = true;
item.checked=true
} else {
item.checked=false
item.isDefault = false;
}
});

View File

@ -75,6 +75,9 @@ public class OrderController {
ordersEntity.setCouponCode(ordersEntitys.getCouponCode());
ordersEntity.setCouponName(ordersEntitys.getCouponName());
ordersEntity.setCouponId(ordersEntitys.getCouponId());
total_fee = total_fee + orderService.couponTotal(ordersEntitys.getCouponTypeId(),Double.parseDouble(ordersEntitys.getCouponAmount()),Double.parseDouble(ordersEntitys.getPayAmount()),ordersEntitys.getBuyCount());
}else{
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount() ;
}
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
@ -84,7 +87,6 @@ public class OrderController {
orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName());
productId.append(ordersEntitys.getProductCode()+",");
productName.append(ordersEntitys.getProductName()+",");
total_fee = total_fee + orderService.couponTotal(ordersEntitys.getCouponTypeId(),Double.parseDouble(ordersEntitys.getCouponAmount()),Double.parseDouble(ordersEntitys.getPayAmount()),ordersEntitys.getBuyCount());
memberId = ordersEntitys.getMemberId();
mobile = ordersEntitys.getPhoneNumber();
buyCount = buyCount + ordersEntitys.getBuyCount();
@ -136,6 +138,9 @@ public class OrderController {
ordersEntity.setCouponCode(ordersEntitys.getCouponCode());
ordersEntity.setCouponName(ordersEntitys.getCouponName());
ordersEntity.setCouponId(ordersEntitys.getCouponId());
total_fee = total_fee + orderService.couponTotal(ordersEntitys.getCouponTypeId(),Double.parseDouble(ordersEntitys.getCouponAmount()),Double.parseDouble(ordersEntitys.getPayAmount()),ordersEntitys.getBuyCount());
}else{
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount() ;
}
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
@ -145,7 +150,7 @@ public class OrderController {
orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName());
productId.append(ordersEntitys.getProductCode()+",");
productName.append(ordersEntitys.getProductName()+",");
total_fee = total_fee + orderService.couponTotal(ordersEntitys.getCouponTypeId(),Double.parseDouble(ordersEntitys.getCouponAmount()),Double.parseDouble(ordersEntitys.getPayAmount()),ordersEntitys.getBuyCount());
memberId = ordersEntitys.getMemberId();
mobile = ordersEntitys.getPhoneNumber();
buyCount = buyCount + ordersEntitys.getBuyCount();