Merge branch 'sit-Carl' of gitee.com:carl_Ming_1/smart-admin into sit-He
@ -147,26 +147,26 @@ export const userLongin = (mobile, pet, address) => {
|
||||
//注册
|
||||
export const useredit = (mobile, pet, address) => {
|
||||
var data = {
|
||||
mobile: mobile,
|
||||
memberName: '',
|
||||
realName: '',
|
||||
gender: '',
|
||||
email: '',
|
||||
openId: '',
|
||||
unionId: '',
|
||||
birthday: '',
|
||||
provinceId: '',
|
||||
cityId: '',
|
||||
districtId: '',
|
||||
storeCode: '',
|
||||
remark: '',
|
||||
memberMark: '',
|
||||
|
||||
remark: ''
|
||||
mobile:mobile,
|
||||
memberName:'',
|
||||
realName:'',
|
||||
gender:'',
|
||||
email:'',
|
||||
openId:'',
|
||||
unionId:'',
|
||||
birthday:'',
|
||||
provinceId:'',
|
||||
cityId:'',
|
||||
districtId:'',
|
||||
storeCode:'',
|
||||
remark:'',
|
||||
memberMark:'',
|
||||
|
||||
remark:''
|
||||
}
|
||||
return fetch('member?type=add', data, 'POST')
|
||||
return fetch('member?type=add', data, 'POST' )
|
||||
}
|
||||
//查询标品全部信息
|
||||
//查询标品全部信息
|
||||
// export const userquery = (mobile, pet,address) => {
|
||||
// var data = {
|
||||
// channelId:"15",
|
||||
@ -239,11 +239,7 @@ export const searchchanpin = (stype,usertype,curPage,curRow) => {
|
||||
for(var key in list){
|
||||
str = str + key + "=" + list[key] + "&";
|
||||
}
|
||||
str = str.substr(0, str.length - 1);
|
||||
var data = {
|
||||
page: 1,
|
||||
row: 10
|
||||
}
|
||||
|
||||
return fetch('product/query?petType='+usertype+str+queryTail, data, 'POST' )
|
||||
}
|
||||
|
||||
|
@ -1,351 +0,0 @@
|
||||
|
||||
// 手机端
|
||||
@media screen and(min-width: 320px) and(max-width:768px) {
|
||||
.active {
|
||||
font-size: 14px;
|
||||
color: #e2001a;
|
||||
cursor: pointer;
|
||||
}
|
||||
.unactive {
|
||||
font-size: 14px;
|
||||
color: #444444;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rc-layout-container {
|
||||
|
||||
|
||||
width: 100%;
|
||||
.rc-main {
|
||||
.rc-usermaina{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.rc-headera {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 64px;
|
||||
align-items: center;
|
||||
}
|
||||
.rc-userheader{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.rc-center {
|
||||
width: 100%;
|
||||
height: 245px;
|
||||
margin-top: 8px;
|
||||
.rc-usermain {
|
||||
.pc-bottom{
|
||||
display: none;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
.rc-image {
|
||||
border: 1px solid #D8D8D8;
|
||||
margin-top: 17px;
|
||||
;
|
||||
img {
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
display: block;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.rc-right {
|
||||
|
||||
.rc-userbottomm{
|
||||
display: none;
|
||||
}
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
margin-left: 16px;
|
||||
justify-content: center;
|
||||
em
|
||||
{
|
||||
font-style: normal;
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
margin-top: 18px;
|
||||
font-weight: bold;
|
||||
|
||||
color: #E1001A;
|
||||
}
|
||||
}
|
||||
.rc-userright {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
color: #666666;
|
||||
font-size: 14px;
|
||||
span{
|
||||
display: block;
|
||||
margin-top: 16px;
|
||||
}
|
||||
}
|
||||
.rc-userbottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 8px;
|
||||
span{
|
||||
color: #666666;
|
||||
font-size: 14px;
|
||||
}
|
||||
i{
|
||||
font-style: normal;
|
||||
color: #E1001A;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rc-bottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 24px;
|
||||
span {
|
||||
display: block;
|
||||
width: 130px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
color: #e2001a;
|
||||
height: 40px;
|
||||
border: 2px solid #e2001a;
|
||||
justify-content: center;
|
||||
border-radius: 30px;
|
||||
font-weight: bold;
|
||||
}
|
||||
span:last-child{
|
||||
margin-left: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rc-title {
|
||||
height: 52px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #d8d8d8;
|
||||
justify-content: space-between;
|
||||
span{
|
||||
font-size: 14px;
|
||||
color: #999999;
|
||||
margin-left: 8px;
|
||||
}
|
||||
em{
|
||||
font-style: normal;
|
||||
font-size: 14px;
|
||||
|
||||
color: #333333;
|
||||
}
|
||||
i{
|
||||
font-style: normal;
|
||||
font-size: 14px;
|
||||
|
||||
color: #333333;
|
||||
}
|
||||
.rc-usertitle strong{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// /* 最小768px最大1920 *pc端/
|
||||
@media screen and (min-width: 768px) and (max-width: 1920px) {
|
||||
.active {
|
||||
font-size: 18px;
|
||||
color: #e2001a;
|
||||
cursor: pointer;
|
||||
// margin-left: 40px;
|
||||
}
|
||||
.unactive {
|
||||
font-size: 18px;
|
||||
color: #444444;
|
||||
cursor: pointer;
|
||||
// margin-left: 80px;
|
||||
}
|
||||
.rc-layout-container {
|
||||
.rc-main {
|
||||
.rc-headera {
|
||||
display: flex;
|
||||
height: 64px;
|
||||
align-items: center;
|
||||
border: 1px solid #D7D7D7;
|
||||
border-radius: 3px 3px 0px 0px;
|
||||
font-size: 18px;
|
||||
span:first-child{
|
||||
margin-left: 40px;
|
||||
}
|
||||
span{
|
||||
margin-left: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
.rc-userheader{
|
||||
width: 100%;
|
||||
height: 64px;
|
||||
background: #F6F6F6;
|
||||
border: 1px solid #D7D7D7;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 18px;
|
||||
span:first-child{
|
||||
margin-left: 173px;
|
||||
}
|
||||
span:last-child{
|
||||
margin-right: 87px;
|
||||
}
|
||||
}
|
||||
|
||||
.rc-center {
|
||||
width: 100%;
|
||||
height: 220px;
|
||||
border: 1px solid #D7D7D7;
|
||||
.rc-usermain {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 164px;
|
||||
.rc-usercenter{
|
||||
width: 25%;
|
||||
em{
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
.rc-image {
|
||||
border: 1px solid #D8D8D8;
|
||||
margin-left: 40px;
|
||||
|
||||
img {
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
display: block;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.rc-right {
|
||||
.rc-userbottom{
|
||||
display: none;
|
||||
}
|
||||
display: flex;
|
||||
|
||||
width: 100%;
|
||||
margin-left: 16px;
|
||||
|
||||
em
|
||||
{
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
margin-top: 18px;
|
||||
|
||||
color: #E1001A;
|
||||
}
|
||||
}
|
||||
.rc-userright {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
color: #666666;
|
||||
font-size: 16px;
|
||||
span{
|
||||
display: block;
|
||||
margin-top: 6px;
|
||||
}
|
||||
}
|
||||
.rc-userbottomm {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 58%;
|
||||
font-size: 20px;
|
||||
color: #E1001A;
|
||||
font-weight: bold;
|
||||
i{
|
||||
font-style: normal;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.pc-bottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
margin-right: 40px;
|
||||
|
||||
span {
|
||||
display: block;
|
||||
width: 130px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 40px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
color: #e2001a;
|
||||
height: 40px;
|
||||
border: 2px solid #e2001a;
|
||||
justify-content: center;
|
||||
border-radius: 30px;
|
||||
}
|
||||
span:last-child{
|
||||
margin-top: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rc-bottom {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.rc-title {
|
||||
height: 55px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #d8d8d8;
|
||||
justify-content: space-between;
|
||||
span{
|
||||
font-size: 16px;
|
||||
color: #999999;
|
||||
margin-left: 8px;
|
||||
}
|
||||
strong{
|
||||
font-style: normal;
|
||||
font-size: 16px;
|
||||
color: #444444;
|
||||
}
|
||||
em{
|
||||
font-style: normal;
|
||||
font-size: 16px;
|
||||
|
||||
color: #333333;
|
||||
}
|
||||
i{
|
||||
font-style: normal;
|
||||
font-size: 16px;
|
||||
margin-left: 40px;
|
||||
|
||||
color: #333333;
|
||||
}
|
||||
.rc-usertitle{
|
||||
margin-right: 73px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
em{
|
||||
display: block;
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.1 KiB |
@ -79,7 +79,8 @@ export default {
|
||||
},
|
||||
// Build Configuration: https://go.nuxtjs.dev/config-build
|
||||
build: {
|
||||
analyze: true, assetFilter: function (assetFilename) { return assetFilename.endsWith('.js'); },
|
||||
analyze: true, assetFilter: function(assetFilename) { return assetFilename.endsWith('.js'); }
|
||||
|
||||
},
|
||||
// axios: {
|
||||
// proxy: true,
|
||||
|
@ -1,12 +1,11 @@
|
||||
<template>
|
||||
<div class="settlement">
|
||||
<Myheader></Myheader>
|
||||
|
||||
|
||||
<div class="rc-main">
|
||||
<tabs></tabs>
|
||||
|
||||
<div class="address-list">
|
||||
<tabs></tabs>
|
||||
<div class="online"></div>
|
||||
|
||||
<div class="rc-main" v-for="(item,index) in goldmedal" :key="index" >
|
||||
<div class="rc-border"></div>
|
||||
<div
|
||||
class="mypersonal"
|
||||
v-for="(item, index) in useraddress"
|
||||
@ -107,13 +106,11 @@
|
||||
|
||||
<script>
|
||||
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 itemMixin from "../../../smart-admin-web/src/components/main/components/side-menu/item-mixin";
|
||||
import {userin} from "../../ajax/getData";
|
||||
import tabs from "@/components/tabs.vue";
|
||||
export default {
|
||||
middleware: "metaTitle",
|
||||
meta: { title: "订单结算" },
|
||||
middleware: 'metaTitle',
|
||||
meta: {title: '订单结算'},
|
||||
data() {
|
||||
return {
|
||||
goldmedal: [],
|
||||
@ -129,18 +126,39 @@ export default {
|
||||
curAddress: {},
|
||||
saveType: "",
|
||||
useraddress: [
|
||||
// {
|
||||
// state: "李某某",
|
||||
// tel: "15124117917",
|
||||
// address: "广东省 广州市 天河区 天河客运站118号",
|
||||
// isdefault: true,
|
||||
// },
|
||||
// {
|
||||
// state: "李某某",
|
||||
// tel: "15124117917",
|
||||
// address: "广东省 广州市 天河区 天河客运站118号",
|
||||
// isdefault: false,
|
||||
// },
|
||||
{
|
||||
state: "李某某",
|
||||
tel: "15124117917",
|
||||
address: "广东省 广州市 天河区 天河客运站118号",
|
||||
},
|
||||
{
|
||||
state: "李某某",
|
||||
tel: "15124117917",
|
||||
address: "广东省 广州市 天河区 天河客运站118号",
|
||||
},
|
||||
{
|
||||
state: "李某某",
|
||||
tel: "15124117917",
|
||||
address: "广东省 广州市 天河区 天河客运站118号",
|
||||
},
|
||||
{
|
||||
state: "李某某",
|
||||
tel: "15124117917",
|
||||
address: "广东省 广州市 天河区 天河客运站118号",
|
||||
},
|
||||
],
|
||||
|
||||
goldmedal: [
|
||||
{
|
||||
ordernumber: "1111111111111111111",
|
||||
orderstype: 1,
|
||||
index:0,
|
||||
usereat: "英国短毛猫成猫全价湿粮",
|
||||
num: "5kg",
|
||||
specification: "1",
|
||||
userprice: "167.00",
|
||||
catimage: require("../../assets/image/rc-win.png"),
|
||||
},
|
||||
],
|
||||
shopprice: {
|
||||
price: "标准快递",
|
||||
@ -311,16 +329,12 @@ export default {
|
||||
},
|
||||
components: {
|
||||
Myheader,
|
||||
tabs,
|
||||
myAddress,
|
||||
tabs
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@import "./settlement.less";
|
||||
@import url("../../assets/css/global.less");
|
||||
// @import url("../../assets/css/settlement.less");
|
||||
|
||||
@import url("../../assets/css/settlement.less");
|
||||
</style>
|
@ -1,48 +1,77 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="user">
|
||||
<Myheader></Myheader>
|
||||
<!-- <unlogin></unlogin> -->
|
||||
<!-- <tabs></tabs> -->
|
||||
<div class="online" id="fixed-catbar-seperator"></div>
|
||||
<div class="rc-top"></div>
|
||||
<div
|
||||
class="
|
||||
rc-usermain
|
||||
ts-product-detail
|
||||
rc-max-width--xl
|
||||
rc-layout-container rc-two-column rc-border-bottom
|
||||
rc-border-colour--brand4
|
||||
"
|
||||
>
|
||||
<!--
|
||||
<magnifier v-bind:parentmsg="msg" ></magnifier>
|
||||
-->
|
||||
<div class="rc-column">
|
||||
<div data-js-carousel="" data-image-gallery="true">
|
||||
<div
|
||||
class="rc-carousel rc-carousel__gallery-image"
|
||||
data-zoom-container="328b2e5f-6904-4cac-9709-51ed18d2500f"
|
||||
data-zoom-factor="2"
|
||||
>
|
||||
<!-- Big images-->
|
||||
|
||||
<div v-for="(item, index) in productAttachmentList" :key="index">
|
||||
<div>
|
||||
<img
|
||||
:src="item.attachmentPath + '?w=420&fm=jpg&auto=compress'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div>
|
||||
<div>
|
||||
<img
|
||||
src="https://cdn.royalcanin-weshare-online.io/m2kia2QBG95Xk-RBC8jn/v1/medium-maxi-giant-pos-2012-packshots-ma-ad-shn-packshot?w=420&fm=jpg&auto=compress"
|
||||
alt="Product alt text"
|
||||
/>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Big images end-->
|
||||
<div>
|
||||
<div class="user" v-for="(item,index) in newlist" :key="index">
|
||||
<Myheader></Myheader>
|
||||
<unlogin></unlogin>
|
||||
<tabs></tabs>
|
||||
<div class="online" id="fixed-catbar-seperator"></div>
|
||||
<div class="rc-top"></div>
|
||||
<div class="rc-usermain ts-product-detail rc-max-width--xl rc-layout-container rc-two-column rc-border-bottom rc-border-colour--brand4">
|
||||
<div class="rc-column">
|
||||
<div data-js-carousel="" data-image-gallery="true">
|
||||
<div class="rc-carousel rc-carousel__gallery-image" data-zoom-container="328b2e5f-6904-4cac-9709-51ed18d2500f" data-zoom-factor="2">
|
||||
<!-- Big images-->
|
||||
<div>
|
||||
<div>
|
||||
<img src="https://cdn.royalcanin-weshare-online.io/m2kia2QBG95Xk-RBC8jn/v1/medium-maxi-giant-pos-2012-packshots-ma-ad-shn-packshot?w=420&fm=jpg&auto=compress" alt="Product alt text" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<img src="https://cdn.royalcanin-weshare-online.io/m2kia2QBG95Xk-RBC8jn/v1/medium-maxi-giant-pos-2012-packshots-ma-ad-shn-packshot?w=420&fm=jpg&auto=compress" alt="Product alt text" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- Big images end-->
|
||||
</div>
|
||||
<div class="rc-carousel__gallery-thumbnails-wrapper">
|
||||
<div class="rc-carousel rc-carousel__gallery-thumbnails">
|
||||
<!-- Thunb images-->
|
||||
<div class="rc-carousel__gallery-thumbnail">
|
||||
<figure class="rc-img--square" style="background-image: url('https://cdn.royalcanin-weshare-online.io/m2kia2QBG95Xk-RBC8jn/v1/medium-maxi-giant-pos-2012-packshots-ma-ad-shn-packshot?w=64&fm=jpg&auto=compress')">
|
||||
<figcaption class="rc-screen-reader-text">Product caption text</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
<div class="rc-carousel__gallery-thumbnail">
|
||||
<figure class="rc-img--square" style="background-image: url('https://cdn.royalcanin-weshare-online.io/UCEUa2QBaxEApS7L_-Xz/v2/fbn-2013-graphiccodes-packshots-siam-ad-int-fbn-packshot?w=64&fm=jpg&auto=compress')">
|
||||
<figcaption class="rc-screen-reader-text">Product caption text</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
<!-- Thunb images end-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ts-product-header rc-column" id="328b2e5f-6904-4cac-9709-51ed18d2500f">
|
||||
<div class="usermain">
|
||||
<div class="online bold rc-md-down"></div>
|
||||
<div class="rc-main">
|
||||
<div class="rc-title">
|
||||
<h2>{{ item.productName }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="online rc-md-down"></div>
|
||||
<div class="rc-main">
|
||||
<div class="productdetails">
|
||||
<div class="rc-productdetail">
|
||||
<i class="ts-row-title">商品价格:</i>
|
||||
<span class="ts-realprice">¥{{ item.rsp }}</span>
|
||||
<span class="ts-remove ts-ecprice">¥{{ item.ecPrice }} </span>
|
||||
</div>
|
||||
<div class="rc-productdetai">
|
||||
<div>
|
||||
<i class="ts-row-title">活动促销:</i>
|
||||
<span>全场商品限时优惠</span>
|
||||
</div>
|
||||
<em class="ts-right-arr" @click="userget()">立即领取</em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="online bold rc-md-down"></div>
|
||||
<div class="rc-main rc-md-up">
|
||||
<div class="online"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="rc-carousel__gallery-thumbnails-wrapper">
|
||||
@ -266,25 +295,25 @@ export default {
|
||||
// meta: {title: '产品详情'},
|
||||
data() {
|
||||
return {
|
||||
tableLabelTest: [],
|
||||
tableLabelTest:[],
|
||||
userimage: require("../../assets/image/unused.png"),
|
||||
activeIndexa: 0,
|
||||
gotop: false,
|
||||
dialogInfo1: false,
|
||||
activeIndexa:0,
|
||||
gotop: false,
|
||||
dialogInfo1:false,
|
||||
name: [],
|
||||
userlist: [],
|
||||
drawlist: [], //用户可以领取的优惠券
|
||||
alldraw: [],
|
||||
userlistmenu: [],
|
||||
msg: ["11111111"],
|
||||
parent_msg: ["111"],
|
||||
usermessage: [],
|
||||
dialogInfo2: false,
|
||||
productCode: "", //商品code
|
||||
productlist: [],
|
||||
userbuy: true,
|
||||
sales_num: 1,
|
||||
usernewlist: [
|
||||
userlist:[],
|
||||
drawlist:[],//用户可以领取的优惠券
|
||||
alldraw:[],
|
||||
userlistmenu:[],
|
||||
msg:['11111111'],
|
||||
parent_msg:['111'],
|
||||
usermessage:[],
|
||||
dialogInfo2:false,
|
||||
productCode:'',//商品code
|
||||
productlist:[],
|
||||
userbuy:true,
|
||||
sales_num:1,
|
||||
usernewlist: [
|
||||
{
|
||||
price: "30",
|
||||
pricestype: "新客优惠券",
|
||||
@ -377,6 +406,35 @@ export default {
|
||||
|
||||
components: {
|
||||
Myheader,
|
||||
tabs,
|
||||
unlogin,
|
||||
Myfooter
|
||||
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener("scroll", this.handleScroll, true);
|
||||
if(this.usermessage!=='' ||this.usermessage.data!==undefined){
|
||||
this.usermessage= JSON.parse(localStorage.getItem("userInfo"));
|
||||
let stype=this.$route.query.stype;
|
||||
this.productCode=this.$route.query.productCode;
|
||||
console.log(this.productCode)
|
||||
this.userquery(this.productCode);
|
||||
console.log(this.userlistmenu)
|
||||
this.$nextTick(()=>{
|
||||
|
||||
})
|
||||
if(stype==1){
|
||||
this.userbuy=true;
|
||||
}else if(stype==2){
|
||||
console.log('这是要消失的')
|
||||
this.$nextTick(() => {
|
||||
this.userbuy=false;
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
tabs,
|
||||
magnifier,
|
||||
@ -406,19 +464,21 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(["changemessage"]),
|
||||
handleScroll(e) {
|
||||
let fixedCatbarSeperator = document.querySelector(
|
||||
"#fixed-catbar-seperator"
|
||||
);
|
||||
let scrolltop =
|
||||
document.documentElement.scrollTop || document.body.scrollTop;
|
||||
if (fixedCatbarSeperator !== "null") {
|
||||
if (scrolltop - fixedCatbarSeperator.offsetTop) {
|
||||
this.gotop = true;
|
||||
} else {
|
||||
this.gotop = false;
|
||||
}
|
||||
}
|
||||
handleScroll(e)
|
||||
{
|
||||
let fixedCatbarSeperator = document.querySelector("#fixed-catbar-seperator");
|
||||
let scrolltop = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
if(fixedCatbarSeperator!=='null' ){
|
||||
if((scrolltop-fixedCatbarSeperator.offsetTop))
|
||||
{
|
||||
this.gotop = true
|
||||
}
|
||||
else
|
||||
{
|
||||
this.gotop = false;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
lianxi(item, index) {
|
||||
console.log(item, index);
|
||||
@ -586,27 +646,47 @@ export default {
|
||||
this.sales_num = parseInt(this.sales_num) - 1;
|
||||
}
|
||||
},
|
||||
usertanchu(item,orderm){
|
||||
|
||||
async courseId(item) {
|
||||
console.log(item);
|
||||
console.log(this.usermessage);
|
||||
// let userid=JSON.parse(location.getItem('userInfo'));
|
||||
// let mobile=JSON.parse(location.getItem('userInfo'));
|
||||
// console.log(userid,mobile);
|
||||
let data = await postCourseId(
|
||||
this.productCode,
|
||||
this.sales_num,
|
||||
this.usermessage.data.id,
|
||||
this.usermessage.data.mobile,
|
||||
item.picFile,
|
||||
item.productName,
|
||||
item.basePrice,
|
||||
item.specifications
|
||||
);
|
||||
if (data) {
|
||||
this.productlist = data;
|
||||
}
|
||||
console.log(data);
|
||||
let user= localStorage.getItem("userInfo");
|
||||
if(user==undefined||user==null||user==''){
|
||||
this.dialogInfo2=true;
|
||||
return
|
||||
}else{
|
||||
|
||||
this.courseId(item);
|
||||
if(orderm==0){
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '加入购物车成功'
|
||||
});
|
||||
}
|
||||
if(orderm==1){
|
||||
this.$router.push({
|
||||
path: "/myorder/userrecord",
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
userget(){
|
||||
|
||||
|
||||
let user= localStorage.getItem("userInfo");
|
||||
if(user==undefined||user==null||user==''){
|
||||
this.dialogInfo2=true;
|
||||
return
|
||||
}else{
|
||||
this.userdraw(this.usermessage.data.mobile);
|
||||
this.alldrawlist(this.usermessage.data.id);
|
||||
this.dialogInfo1=true;
|
||||
}
|
||||
|
||||
},
|
||||
usertanchu(item, orderm) {
|
||||
let user = localStorage.getItem("userInfo");
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Vue from 'vue'
|
||||
import VueAwesomeSwiper from 'vue-awesome-swiper'
|
||||
|
||||
import Vue from 'vue'
|
||||
import VueAwesomeSwiper from 'vue-awesome-swiper'
|
||||
|
||||
Vue.use(VueAwesomeSwiper)
|
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 25 KiB |
@ -29,6 +29,15 @@
|
||||
</dependency>
|
||||
|
||||
-->
|
||||
|
||||
<!--JWT-->
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.8.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
|
@ -70,8 +70,11 @@ public class SmartAuthenticationInterceptor extends HandlerInterceptorAdapter {
|
||||
if (isNoNeedLogin) {
|
||||
return true;
|
||||
}
|
||||
Boolean noNeedLogin = request.getServletPath().startsWith("/royalcanin");
|
||||
if (noNeedLogin) {
|
||||
Boolean noNeedLogin = request.getServletPath().contains("royalcanin");
|
||||
Boolean noNeedLoginToo = request.getContextPath().contains("royalcanin");
|
||||
System.out.println("request.getContextPath() : " + request.getRequestURI());
|
||||
System.out.println("request.getRequestURI() : " + request.getRequestURI());
|
||||
if (noNeedLogin||noNeedLoginToo) {
|
||||
return true;
|
||||
}
|
||||
//放行的Uri前缀
|
||||
|
@ -1,47 +1,25 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import eu.bitwalker.useragentutils.UserAgent;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import net.lab1024.smartadmin.common.constant.JudgeEnum;
|
||||
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
||||
import net.lab1024.smartadmin.module.business.log.LogService;
|
||||
import net.lab1024.smartadmin.module.business.log.userloginlog.domain.UserLoginLogEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.member.*;
|
||||
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
|
||||
import net.lab1024.smartadmin.util.SmartJWTUtil;
|
||||
import net.lab1024.smartadmin.util.SmartHttpUtil;
|
||||
import net.lab1024.smartadmin.util.SmartIPUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
public class MemberService {
|
||||
private String url = "http://miniapp-test.royalcanin.com.cn:7080/crm/member/";
|
||||
|
||||
@Autowired
|
||||
private LogService logService;
|
||||
|
||||
/**
|
||||
* 过期时间一天
|
||||
*/
|
||||
private static final int EXPIRE_SECONDS = 1 * 24 * 3600;
|
||||
/**
|
||||
* jwt加密字段
|
||||
*/
|
||||
private static final String CLAIM_ID_KEY = "id";
|
||||
|
||||
@Value("${jwt.key}")
|
||||
private String jwtKey;
|
||||
|
||||
|
||||
|
||||
|
||||
public String memberGet(MemberGetEntity memberGetEntity, HttpServletRequest request)throws Exception {
|
||||
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(memberGetEntity);
|
||||
@ -52,7 +30,7 @@ public class MemberService {
|
||||
if(jsonObject.getString("code").equals("0")){
|
||||
JSONObject json = JSONObject.parseObject(jsonObject.getString("data"));
|
||||
String id = json.getString("id");
|
||||
jsonObject.put("xaccessToken",generateToken(id));
|
||||
jsonObject.put("xaccessToken", SmartJWTUtil.generateToken(id));
|
||||
return jsonObject.toJSONString();
|
||||
}else {
|
||||
return sb;
|
||||
@ -83,7 +61,7 @@ public class MemberService {
|
||||
return SmartHttpUtil.httpPostRaw(url+"check",jsonObject.toString(),null,"utf-8");
|
||||
}
|
||||
|
||||
public String memberUpdate(MemberUpdateEntity memberUpdateEntity)throws Exception{
|
||||
public String memberUpdate(MemberUpdateEntity memberUpdateEntity){
|
||||
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(memberUpdateEntity);
|
||||
paramMap.put("id",StringUtil.toString(memberUpdateEntity.getId()).equals("0")?null:StringUtil.toString(memberUpdateEntity.getId()));
|
||||
paramMap.put("cityId",StringUtil.toString(memberUpdateEntity.getCityId()).equals("0")?null:StringUtil.toString(memberUpdateEntity.getCityId()));
|
||||
@ -94,25 +72,7 @@ public class MemberService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 功能描述: 生成JWT TOKEN
|
||||
*
|
||||
* @return
|
||||
* @auther Carl
|
||||
* @date 2021/12/8 0012
|
||||
*/
|
||||
public String generateToken(String UserId) {
|
||||
Long id = Long.parseLong(UserId);
|
||||
/**将token设置为jwt格式*/
|
||||
String baseToken = UUID.randomUUID().toString();
|
||||
LocalDateTime localDateTimeNow = LocalDateTime.now();
|
||||
LocalDateTime localDateTimeExpire = localDateTimeNow.plusSeconds(EXPIRE_SECONDS);
|
||||
Date from = Date.from(localDateTimeNow.atZone(ZoneId.systemDefault()).toInstant());
|
||||
Date expire = Date.from(localDateTimeExpire.atZone(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
Claims jwtClaims = Jwts.claims().setSubject(baseToken);
|
||||
jwtClaims.put(CLAIM_ID_KEY, id);
|
||||
String compactJws = Jwts.builder().setClaims(jwtClaims).setNotBefore(from).setExpiration(expire).signWith(SignatureAlgorithm.HS512, jwtKey).compact();
|
||||
return compactJws;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -53,6 +53,9 @@ public class SMSController {
|
||||
String tamp = requestMap.get("tamp").toString();
|
||||
String msgNum = requestMap.get("msgNum").toString();
|
||||
String hash = MD5Utils.getMD5Code(KEY + "@" + tamp + "@" + msgNum);
|
||||
if(tamp == "")
|
||||
return ResponseDTO.wrap(OrderResponseCodeConst.SMS_FAIL);
|
||||
|
||||
if (tamp.compareTo(currentTime) > 0) {
|
||||
if (hash.equalsIgnoreCase(requestHash)){
|
||||
//校验成功
|
||||
|
@ -17,11 +17,13 @@ import net.lab1024.smartadmin.module.system.royalcanin.good.model.ProductMasterQ
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.ProductQueryEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.service.CartService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.service.GoodService;
|
||||
import net.lab1024.smartadmin.util.SmartJWTUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
@ -33,6 +35,8 @@ public class GoodController {
|
||||
@Autowired
|
||||
private RoyalcaninOperateLogService royalcaninOperateLogService;
|
||||
|
||||
public static final String TOKEN_NAME = "x-access-token";
|
||||
|
||||
@Autowired
|
||||
private CartService cartService;
|
||||
|
||||
@ -119,18 +123,19 @@ public class GoodController {
|
||||
|
||||
@ApiOperation(value = "查询购物车信息", notes = "查询购物车信息")
|
||||
@PostMapping("royalcanin/getCartProductInfo")
|
||||
public List<CartEntity> getCartProductInfo(String memberId){
|
||||
public List<CartEntity> getCartProductInfo(HttpServletRequest request){
|
||||
String memberId = SmartJWTUtil.decodeToken(request.getHeader(TOKEN_NAME));
|
||||
return cartService.getAllProductbyMember(memberId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除购物车信息", notes = "删除购物车信息")
|
||||
@PostMapping("royalcanin/cancelCartProductInfo")
|
||||
public ResponseDTO<String> cancelCartProductInfo(String memberId,@RequestBody List<String> productCode){
|
||||
public ResponseDTO<String> cancelCartProductInfo(HttpServletRequest request, @RequestBody List<String> productCode){
|
||||
String memberId = SmartJWTUtil.decodeToken(request.getHeader(TOKEN_NAME));
|
||||
for (int i = 0 ;i < productCode.size();i++) {
|
||||
cartService.cancelProduct(memberId,productCode.get(i));
|
||||
}
|
||||
return ResponseDTO.succ();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.good;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.internal.util.AlipaySignature;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -13,6 +14,7 @@ import net.lab1024.smartadmin.module.system.alipay.alipayModel.AliPayEntity;
|
||||
import net.lab1024.smartadmin.module.system.alipay.conf.AlipayConfig;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.constant.OrderResponseCodeConst;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderAddress;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrdersEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.service.CartService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.service.OrderService;
|
||||
@ -101,7 +103,7 @@ public class OrderController {
|
||||
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
||||
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
|
||||
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
||||
return ResponseDTO.succData(wxpayService.generateQRCode(wxPayEntity));
|
||||
return ResponseDTO.succData(ordersEntity.getOrderNo(),wxpayService.generateQRCode(wxPayEntity));
|
||||
}
|
||||
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL);
|
||||
}
|
||||
@ -168,6 +170,31 @@ public class OrderController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "重新支付", notes = "重新支付")
|
||||
@PostMapping("royalcanin/repayOrderWX")
|
||||
public ResponseDTO<String> repayOrderWX(String orderNo) throws Exception {
|
||||
OrderEntity ordersEntity = orderService.findByOrderId(orderNo);
|
||||
if(ordersEntity != null){
|
||||
QueryEntity queryEntity = new QueryEntity();
|
||||
queryEntity.setOrderNumber(ordersEntity.getOrderNo());
|
||||
String orderInfo = orderService.query(queryEntity);
|
||||
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(orderInfo);
|
||||
JSONObject jsonObject = (JSONObject)jsonArray.get(0);
|
||||
if(jsonObject.getString("status").equals("0")) {
|
||||
WxPayEntity wxPayEntity = new WxPayEntity();
|
||||
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
||||
wxPayEntity.setTotal_fee(jsonObject.getString("salesAmount"));
|
||||
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
||||
return ResponseDTO.succData(orderInfo, wxpayService.generateQRCode(wxPayEntity));
|
||||
}else {
|
||||
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,orderInfo);
|
||||
}
|
||||
}else {
|
||||
return ResponseDTO.wrap(OrderResponseCodeConst.WITHOUT_ORDER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "更新订单", notes = "更新订单")
|
||||
|
@ -20,6 +20,8 @@ public class OrderResponseCodeConst extends ResponseCodeConst {
|
||||
|
||||
public static final OrderResponseCodeConst WITHOUT_ORDER = new OrderResponseCodeConst(9007, "没有该订单数据!");
|
||||
|
||||
public static final OrderResponseCodeConst GENERATE_ORDER_ERROR = new OrderResponseCodeConst(9008, "该订单数据有误,请联系管理员!");
|
||||
|
||||
public OrderResponseCodeConst(int code, String msg) {
|
||||
super(code, msg);
|
||||
}
|
||||
|
@ -162,7 +162,24 @@ public class OrderService {
|
||||
addOrSaveEntity.setDeliveryType(jsonObject.getString("deliveryType"));
|
||||
addOrSaveEntity.setSalesAmount(jsonObject.getString("salesAmount"));
|
||||
addOrSaveEntity.setOrderDate(jsonObject.getString("orderDate"));
|
||||
addOrSaveEntity.setAddressCityName(jsonObject.getString("addressCityName"));
|
||||
addOrSaveEntity.setAddressCountyName(jsonObject.getString("addressCountyName"));
|
||||
addOrSaveEntity.setAddressDetailInfo(jsonObject.getString("addressDetailInfo"));
|
||||
addOrSaveEntity.setAddressPhoneNumber(jsonObject.getString("addressPhoneNumber"));
|
||||
addOrSaveEntity.setAddressProvinceName(jsonObject.getString("addressProvinceName"));
|
||||
addOrSaveEntity.setAddressUserName(jsonObject.getString("addressUserName"));
|
||||
addOrSaveEntity.setPaymentAmount(totalFee);
|
||||
if (ordersEntity.getCouponCode() != ""&& null != ordersEntity.getCouponCode()) {
|
||||
//coupon json化
|
||||
OrderCouponEntity orderCouponEntity = new OrderCouponEntity();
|
||||
orderCouponEntity.setCouponCode(ordersEntity.getCouponCode());
|
||||
orderCouponEntity.setCouponName(ordersEntity.getCouponName());
|
||||
orderCouponEntity.setCouponId(ordersEntity.getCouponId());
|
||||
Map<String, String> orderCouponParamMap = MapRemoveNullUtil.setConditionMap(orderCouponEntity);
|
||||
MapRemoveNullUtil.removeNullEntry(orderCouponParamMap);
|
||||
net.sf.json.JSONObject orderCouponJson = net.sf.json.JSONObject.fromObject(orderCouponParamMap);
|
||||
addOrSaveEntity.setOrderCoupon(orderCouponJson.toString());
|
||||
}
|
||||
addOrSave(addOrSaveEntity);
|
||||
return ResponseDTO.succ();
|
||||
}else{
|
||||
@ -247,4 +264,9 @@ public class OrderService {
|
||||
}
|
||||
return endTotal;
|
||||
}
|
||||
|
||||
public OrderEntity findByOrderId(String orderNo){
|
||||
return ordersDao.findByOrderId(orderNo);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class MemberAddressAddEntity {
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
private int memberId;
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 省份ID
|
||||
@ -24,12 +24,12 @@ public class MemberAddressAddEntity {
|
||||
/**
|
||||
* 城市ID
|
||||
*/
|
||||
private int cityId;
|
||||
private String cityId;
|
||||
|
||||
/**
|
||||
* 区ID
|
||||
*/
|
||||
private int districtId;
|
||||
private String districtId;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
|
@ -16,7 +16,7 @@ public class MemberAddressDeleteEntity {
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
private int memberId;
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 宠物ID
|
||||
|
@ -19,5 +19,5 @@ public class MemberAddressGetAllEntity {
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
private int memberId;
|
||||
private String memberId;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class MemberAddressUpdateEntity {
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
private int memberId;
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 会员地址ID
|
||||
@ -32,12 +32,12 @@ public class MemberAddressUpdateEntity {
|
||||
/**
|
||||
* 城市ID
|
||||
*/
|
||||
private int cityId;
|
||||
private String cityId;
|
||||
|
||||
/**
|
||||
* 区ID
|
||||
*/
|
||||
private int districtId;
|
||||
private String districtId;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
|
@ -0,0 +1,11 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.notify.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.notify.model.NotifyEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Mapper
|
||||
@Component
|
||||
public interface NotifyDao extends BaseMapper<NotifyEntity> {
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.notify.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("t_royalcanin_notify_operate_log")
|
||||
public class NotifyEntity {
|
||||
|
||||
private String appId;
|
||||
|
||||
private String mchId;
|
||||
|
||||
private String sign;
|
||||
|
||||
private String resultCode;
|
||||
|
||||
private String errCode;
|
||||
|
||||
private String openid;
|
||||
|
||||
private String tradeType;
|
||||
|
||||
private String totalFee;
|
||||
|
||||
private String feeType;
|
||||
|
||||
private String outTradeNo;
|
||||
|
||||
private String timeEnd;
|
||||
|
||||
private String nonceStr;
|
||||
|
||||
private String remake;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.notify.service;
|
||||
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.notify.dao.NotifyDao;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.notify.model.NotifyEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class NotifyService {
|
||||
|
||||
@Autowired
|
||||
private NotifyDao notifyDao;
|
||||
|
||||
|
||||
public int insertProductCart(NotifyEntity notifyEntity){
|
||||
return notifyDao.insert(notifyEntity);
|
||||
}
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
package net.lab1024.smartadmin.module.system.wxpay;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import net.lab1024.smartadmin.module.system.wxpay.sdk.IWXPayDomain;
|
||||
import net.lab1024.smartadmin.module.system.wxpay.sdk.WXPayConfig;
|
||||
import net.lab1024.smartadmin.module.system.wxpay.sdk.WXPayConstants;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.*;
|
||||
@ -16,8 +14,9 @@ public class MyConfig implements WXPayConfig {
|
||||
// private String path ="C:/Users/Administrator/IdeaProjects/smart-admin/smart-admin-service/smart-admin-api/src/main/resources/wxpay/";
|
||||
private String path ="/home/royalcanin-dev/cert/";
|
||||
|
||||
public String notify_url = "http://47.96.75.242:10086/smart-admin-api/royalcanin/updateOrderWX";
|
||||
// public String notify_url = "http://47.96.75.242:10086/smart-admin-api/royalcanin/updateOrderWX";
|
||||
|
||||
public String notify_url = "https://royalcanincn.escase.cn/jc/royalcanin/royalcanin/updateOrderWX";
|
||||
|
||||
// 微信支付h5 回调地址
|
||||
public static String NOTIFY_URL_H5 = "https://www.XXXXXX.com/server/weixin/WxQuery";
|
||||
@ -37,14 +36,16 @@ public class MyConfig implements WXPayConfig {
|
||||
public String getAppID() {
|
||||
return "wx3c51c14272f63a64";
|
||||
}
|
||||
//wxa9a0ae603bbe6ceb
|
||||
|
||||
public String getMchID() {
|
||||
return "1315161001";
|
||||
}
|
||||
|
||||
// 16717629989
|
||||
public String getKey() {
|
||||
return "b69497999e8fd1f8f1f0a9591b24eb72";
|
||||
}
|
||||
//indexphpcorecertapicert201903200
|
||||
|
||||
public InputStream getCertStream() {
|
||||
ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
|
||||
|
@ -1,6 +1,9 @@
|
||||
package net.lab1024.smartadmin.module.system.wxpay;
|
||||
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.domain.RoyalcaninOperateLogService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.service.OrderService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.notify.model.NotifyEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.notify.service.NotifyService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.AddOrSaveEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity;
|
||||
import net.lab1024.smartadmin.module.system.wxpay.sdk.WXPay;
|
||||
@ -33,6 +36,10 @@ public class WxpayService {
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@Autowired
|
||||
private NotifyService notifyService;
|
||||
|
||||
|
||||
public String generateQRCode(WxPayEntity wxPayEntity) throws Exception {
|
||||
WXPay wxpay = new WXPay(config);
|
||||
InetAddress ip4 = Inet4Address.getLocalHost();
|
||||
@ -71,21 +78,33 @@ public class WxpayService {
|
||||
bufferedReader.close();
|
||||
inputStream.close();
|
||||
Map<String, String> callBackMap = WXPayUtil.xmlToMap(stringBuffer.toString());
|
||||
System.out.println(callBackMap.toString());
|
||||
|
||||
SortedMap<String, String> sortedMap = WXPayUtil.getSortedMap(callBackMap);
|
||||
// 校验签名是否正确
|
||||
if (WXPayUtil.isCorrectSign(sortedMap, config.getKey())) {
|
||||
if (!WXPayUtil.isCorrectSign(sortedMap, config.getKey())) {
|
||||
System.out.println("签名校验成功!");
|
||||
// 更新订单状态
|
||||
if ("SUCCESS".equals(sortedMap.get("result_code"))) {
|
||||
String outTradeNo = sortedMap.get("out_trade_no"); // 流水号
|
||||
String totalFee = sortedMap.get("total_fee"); // 交易金额
|
||||
|
||||
NotifyEntity notifyEntity = new NotifyEntity();
|
||||
notifyEntity.setAppId(sortedMap.get("appid"));
|
||||
notifyEntity.setMchId(sortedMap.get("mch_id"));
|
||||
notifyEntity.setSign(sortedMap.get("sign"));
|
||||
notifyEntity.setResultCode(sortedMap.get("return_code"));
|
||||
notifyEntity.setOpenid(sortedMap.get("openid"));
|
||||
notifyEntity.setOutTradeNo(outTradeNo);
|
||||
notifyEntity.setTotalFee(totalFee);
|
||||
notifyEntity.setTimeEnd(sortedMap.get("time_end"));
|
||||
notifyEntity.setTradeType(sortedMap.get("trade_type"));
|
||||
notifyEntity.setFeeType(sortedMap.get("fee_type"));
|
||||
notifyEntity.setNonceStr(sortedMap.get("nonce_str"));
|
||||
notifyService.insertProductCart(notifyEntity);
|
||||
if (orderService.afterPaySucceedUpdateOrderStatus(outTradeNo,totalFee)) {
|
||||
response.setContentType("text/xml");
|
||||
response.setContentType("content-type");
|
||||
response.getWriter().println("<xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>");
|
||||
response.setContentType("text/xml");
|
||||
response.setContentType("text/html");
|
||||
response.getWriter().println("SUCCESS");
|
||||
QueryEntity queryEntity = new QueryEntity();
|
||||
queryEntity.setOrderNumber(outTradeNo);
|
||||
|
@ -0,0 +1,85 @@
|
||||
package net.lab1024.smartadmin.util;
|
||||
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.JWTVerifier;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
import com.auth0.jwt.exceptions.JWTVerificationException;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SmartJWTUtil {
|
||||
|
||||
/**
|
||||
* 过期时间一天
|
||||
*/
|
||||
private static final int EXPIRE_SECONDS = 1 * 24 * 3600;
|
||||
/**
|
||||
* jwt加密字段
|
||||
*/
|
||||
private static final String CLAIM_ID_KEY = "id";
|
||||
|
||||
//设置过期时间
|
||||
private static final long EXPIRE_DATE = 30 * 60 * 100000;
|
||||
//token秘钥
|
||||
private static final String TOKEN_SECRET = "smart-admin-jwt-key";
|
||||
|
||||
|
||||
|
||||
|
||||
public static String generateToken(String userId) {
|
||||
String token;
|
||||
try {
|
||||
//过期时间
|
||||
Date date = new Date(System.currentTimeMillis() + EXPIRE_DATE);
|
||||
//秘钥及加密算法
|
||||
Algorithm algorithm = Algorithm.HMAC256(TOKEN_SECRET);
|
||||
//设置头部信息
|
||||
Map<String, Object> header = new HashMap<>();
|
||||
header.put("typ", "JWT");
|
||||
header.put("alg", "HS256");
|
||||
//携带UserId信息,生成签名
|
||||
token = JWT.create()
|
||||
.withHeader(header)
|
||||
.withClaim(CLAIM_ID_KEY, userId)
|
||||
.withExpiresAt(date)
|
||||
.sign(algorithm);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* JWT解密
|
||||
*
|
||||
* @Author: RZH
|
||||
* @Date: 2020/4/6 9:30
|
||||
*/
|
||||
public static String decodeToken(final String token) {
|
||||
String userId = null;
|
||||
try {
|
||||
JWTVerifier verifier = JWT.require(Algorithm.HMAC256(TOKEN_SECRET))
|
||||
.build();
|
||||
DecodedJWT jwt = verifier.verify(token);
|
||||
if (jwt != null) {
|
||||
userId = jwt.getClaim(CLAIM_ID_KEY).asString();
|
||||
}
|
||||
} catch (JWTVerificationException exception) {
|
||||
exception.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return userId;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String token = SmartJWTUtil.generateToken("844350");
|
||||
System.out.println(SmartJWTUtil.decodeToken(token));
|
||||
}
|
||||
|
||||
}
|
@ -1684,4 +1684,27 @@ CREATE TABLE IF NOT EXISTS `t_royalcanin_cart` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `t_royalcanin_notify_operate_log`;
|
||||
CREATE TABLE IF NOT EXISTS `t_royalcanin_notify_operate_log` (
|
||||
`id` bigint(200) NOT NULL AUTO_INCREMENT,
|
||||
`app_id` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '微信分配的小程序ID',
|
||||
`mch_id` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '微信支付分配的商户号',
|
||||
`sign` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '签名',
|
||||
`result_code` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'SUCCESS/FAIL',
|
||||
`err_code` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '错误返回的信息描述',
|
||||
`openid` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户在商户appid下的唯一标识',
|
||||
`trade_type` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'JSAPI、NATIVE、APP',
|
||||
`total_fee` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '订单总金额,单位为分',
|
||||
`fee_type` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT ' 货币类型,符合ISO4217标准的三位字母代码,默认人民币:CNY',
|
||||
`out_trade_no` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '商户系统内部订单号,要求32个字符内(最少6个字符),只能是数字、大小写字母_-|*且在同一个商户号下唯一。',
|
||||
`time_end` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付完成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。',
|
||||
`nonce_str` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '随机字符串,不长于32位',
|
||||
`remake` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|