mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
commit
0c0ee6e965
5
package-lock.json
generated
5
package-lock.json
generated
@ -1,6 +1,3 @@
|
|||||||
{
|
{
|
||||||
"name": "smart-admin",
|
"lockfileVersion": 1
|
||||||
"lockfileVersion": 2,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {}
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
¥
|
¥
|
||||||
</i>
|
</i>
|
||||||
<span>
|
<span>
|
||||||
{{ item.couponAmount?item.couponAmount:(parseInt((1-item.discount)*10)+'折') }}
|
{{ item.couponAmount?item.couponAmount:(parseInt(10 - item.discount*10)+'折') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<strong>{{ item.couponName }}</strong>
|
<strong>{{ item.couponName }}</strong>
|
||||||
|
@ -167,7 +167,7 @@
|
|||||||
¥
|
¥
|
||||||
</i>
|
</i>
|
||||||
<span>
|
<span>
|
||||||
{{ item.couponAmount?item.couponAmount:(parseInt((1-item.discount)*10)+'折') }}
|
{{ item.couponAmount?item.couponAmount:(parseInt(10 - item.discount*10)+'折') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<strong>{{ item.couponName }}</strong>
|
<strong>{{ item.couponName }}</strong>
|
||||||
@ -268,7 +268,9 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(["checkIsLogin"]),
|
...mapMutations(["checkIsLogin"]),
|
||||||
|
/* 计算优惠券价格 */
|
||||||
discountedSumPrice() {
|
discountedSumPrice() {
|
||||||
|
/* 判断是否为商品卷 */
|
||||||
if(this.curCoupon.productCodes)
|
if(this.curCoupon.productCodes)
|
||||||
this.finalAmount = this.qualifiedProductDiscount();
|
this.finalAmount = this.qualifiedProductDiscount();
|
||||||
else
|
else
|
||||||
@ -309,15 +311,17 @@ export default {
|
|||||||
return this.sumPrice;
|
return this.sumPrice;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/* 计算价格商品折扣 */
|
||||||
qualifiedProductDiscount(){
|
qualifiedProductDiscount(){
|
||||||
this.discountedItemIndex = 0;
|
this.discountedItemIndex = 0;
|
||||||
let total = 0;
|
let total = 0;
|
||||||
let totalItemNum = 0;
|
let totalItemNum = 0; //判断满足优惠券条件的商品数量
|
||||||
let couponUsed = false;
|
let couponUsed = false;
|
||||||
let tmpShoppingCartList = this.arrSort(this.goldmedal);
|
let tmpShoppingCartList = this.arrSort(this.goldmedal); //对应的商品
|
||||||
let qualifiedProductAmount = 0;
|
let qualifiedProductAmount = 0; //满足条件的优惠券商品价格总价
|
||||||
let skipQualifiedProductAmountCalculating = false;
|
let skipQualifiedProductAmountCalculating = false;
|
||||||
let checkResult = true;
|
let checkResult = true; //是否可使用
|
||||||
|
let selectProduct = []; //满足条件的商品
|
||||||
for(let itemInCart of tmpShoppingCartList) {
|
for(let itemInCart of tmpShoppingCartList) {
|
||||||
if(this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) {
|
if(this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) {
|
||||||
qualifiedProductAmount += (itemInCart.productPrice * itemInCart.buyCount);
|
qualifiedProductAmount += (itemInCart.productPrice * itemInCart.buyCount);
|
||||||
@ -334,8 +338,17 @@ export default {
|
|||||||
checkResult = false;
|
checkResult = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// couponTypeId
|
||||||
|
// 0-不用折扣
|
||||||
|
// 1-狗干粮金额券(50)
|
||||||
|
// 2-通用金额满减券(50)
|
||||||
|
// 3-通用折扣券(6折)
|
||||||
|
// 4-指定干粮折扣券(7折)
|
||||||
|
// 6-指定干粮金额券(100)
|
||||||
for(let itemInCart of tmpShoppingCartList) {
|
for(let itemInCart of tmpShoppingCartList) {
|
||||||
if(this.curCoupon.productCodes && this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1 && !couponUsed && checkResult) {
|
if(this.curCoupon.productCodes && this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1 && !couponUsed && checkResult) {
|
||||||
|
console.log(itemInCart,'itemInCart');
|
||||||
//Into coupon discount calculation
|
//Into coupon discount calculation
|
||||||
switch(this.curCoupon.couponTypeId) {
|
switch(this.curCoupon.couponTypeId) {
|
||||||
case 1: //Amount deduct
|
case 1: //Amount deduct
|
||||||
@ -369,8 +382,8 @@ export default {
|
|||||||
case 3: //Limited product % discount
|
case 3: //Limited product % discount
|
||||||
case 4: //% discount
|
case 4: //% discount
|
||||||
if(this.curCoupon.discount && this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) {
|
if(this.curCoupon.discount && this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) {
|
||||||
total = total + (itemInCart.productPrice * itemInCart.buyCount) * ( 1 - this.curCoupon.discount );
|
total = total + qualifiedProductAmount * ( 1 - this.curCoupon.discount );
|
||||||
this.discountAmount = (itemInCart.productPrice * itemInCart.buyCount) * this.curCoupon.discount;
|
this.discountAmount = qualifiedProductAmount * this.curCoupon.discount;
|
||||||
this.discountedProductCode = itemInCart.productCode;
|
this.discountedProductCode = itemInCart.productCode;
|
||||||
couponUsed=true;
|
couponUsed=true;
|
||||||
skipQualifiedProductAmountCalculating = true;
|
skipQualifiedProductAmountCalculating = true;
|
||||||
@ -517,6 +530,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/* 关闭弹出框 计算价格 */
|
||||||
pickCoupon(item){
|
pickCoupon(item){
|
||||||
this.curCoupon = item;
|
this.curCoupon = item;
|
||||||
this.dialogInfo1 = false;
|
this.dialogInfo1 = false;
|
||||||
|
@ -281,6 +281,9 @@ export default {
|
|||||||
for (let y = 0; y < this.goldmedal.length; y++) {
|
for (let y = 0; y < this.goldmedal.length; y++) {
|
||||||
if(!this.goldmedal[y].orderDetailList)
|
if(!this.goldmedal[y].orderDetailList)
|
||||||
continue;
|
continue;
|
||||||
|
if(!this.useralllist[y]){
|
||||||
|
this.useralllist[y] = {};
|
||||||
|
}
|
||||||
this.useralllist[y].orderNumber = this.goldmedal[y].orderNumber;
|
this.useralllist[y].orderNumber = this.goldmedal[y].orderNumber;
|
||||||
this.useralllist[y].status = this.goldmedal[y].status;
|
this.useralllist[y].status = this.goldmedal[y].status;
|
||||||
this.useralllist[y].addressUserName = this.goldmedal[y].addressUserName;
|
this.useralllist[y].addressUserName = this.goldmedal[y].addressUserName;
|
||||||
@ -353,12 +356,13 @@ export default {
|
|||||||
type: "warning",
|
type: "warning",
|
||||||
message: "取消订单成功",
|
message: "取消订单成功",
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
/* 这个在全部变量去除的时候 记得加 */
|
||||||
this.indet(this.userdata);
|
// setTimeout(() => {
|
||||||
this.activeIndex=0;
|
// this.indet(this.userdata);
|
||||||
this.useralllist=[];
|
// this.activeIndex=0;
|
||||||
}, 500);
|
// this.useralllist=[];
|
||||||
|
// console.log('2222');
|
||||||
|
// }, 500);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -237,7 +237,8 @@
|
|||||||
¥
|
¥
|
||||||
</i>
|
</i>
|
||||||
<span>
|
<span>
|
||||||
{{ item.couponAmount?item.couponAmount:(parseInt((1-item.discount)*10)+'折') }}
|
<!-- 不合并 因为0.1计算器不是0.1 -->
|
||||||
|
{{ item.couponAmount?item.couponAmount:(parseInt(10 - item.discount*10)+'折') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<strong>{{ item.couponName }}</strong>
|
<strong>{{ item.couponName }}</strong>
|
||||||
|
@ -143,7 +143,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { userLongin,sendMsg,vadatnmsg,userregOrLogin,inserdiscount } from "../../ajax/getData";
|
import { userLongin,sendMsg,vadatnmsg,userregOrLogin,inserdiscount } from "../../ajax/getData";
|
||||||
import { mapMutations } from "vuex";
|
import { mapMutations,mapState } from "vuex";
|
||||||
import envData from "~/config/env-data.js";
|
import envData from "~/config/env-data.js";
|
||||||
import Myheader from "~/components/header.vue"; //引用头部公共组件
|
import Myheader from "~/components/header.vue"; //引用头部公共组件
|
||||||
export default {
|
export default {
|
||||||
@ -218,15 +218,19 @@ export default {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
...mapState({
|
||||||
|
userInfo : state => state.user.userInfo,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//console.log(this.$route.params);
|
//console.log(this.$route.params);
|
||||||
this.checkIsLogin();
|
this.checkIsLogin();
|
||||||
let user = this.$store.state.userInfo;
|
let user = this.$store.state.userInfo;
|
||||||
if(user) {
|
if(user || this.userInfo) {
|
||||||
this.$router.push({
|
console.log('333');
|
||||||
path: "/personal/mypersonal",
|
// this.$router.push({
|
||||||
});
|
// path: "/personal/mypersonal",
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// watch: function () {
|
// watch: function () {
|
||||||
|
38
rc-busness/plugins/until/until.js
Normal file
38
rc-busness/plugins/until/until.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
这个是存放静态公共方法
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置cookie的值
|
||||||
|
* @param {String} key cookie的键
|
||||||
|
* @param {String} val cookie的值
|
||||||
|
* @param {String} exdays 过期时间默认的话是7天
|
||||||
|
*/
|
||||||
|
const setCookie = (key,val,exdays = 7)=>{
|
||||||
|
var d = new Date();
|
||||||
|
d.setTime(d.getTime()+(exdays*24*60*60*1000));
|
||||||
|
var expires = "expires="+d.toGMTString();
|
||||||
|
document.cookie = key + "=" + val + "; " + expires;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取cookie的值
|
||||||
|
* @param {String} key cookie的键
|
||||||
|
*/
|
||||||
|
const getCookie = (key)=>{
|
||||||
|
var name = key + "=";
|
||||||
|
var ca = document.cookie.split(';');
|
||||||
|
for(var i=0; i<ca.length; i++){
|
||||||
|
var c = ca[i].trim();
|
||||||
|
if(c.indexOf(name)==0) return c.substring(name.length,c.length);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export {
|
||||||
|
setCookie,
|
||||||
|
getCookie,
|
||||||
|
}
|
@ -1,3 +1,6 @@
|
|||||||
|
import user from './modules/user.js';
|
||||||
|
|
||||||
|
|
||||||
const state = () => ({
|
const state = () => ({
|
||||||
// 这里是全局数据保存的地方
|
// 这里是全局数据保存的地方
|
||||||
tabsList: [
|
tabsList: [
|
||||||
@ -61,4 +64,11 @@ const actions = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {namespaced: true, state, mutations, actions}
|
/* 功能模块 */
|
||||||
|
const modules = {
|
||||||
|
user,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default {namespaced: true, state, mutations, actions,modules}
|
||||||
|
17
rc-busness/store/modules/login.js
Normal file
17
rc-busness/store/modules/login.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
export default {
|
||||||
|
state : {
|
||||||
|
des : '这个存储用户登录逻辑操作',
|
||||||
|
loginState : false, //登录状态
|
||||||
|
},
|
||||||
|
/* 存储修改状态的静态方法 */
|
||||||
|
mutations : {
|
||||||
|
/* 设置登录状态 */
|
||||||
|
SET_LOGIN_STATE(state){
|
||||||
|
console.log(state);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* 存储修改数据的动态方法 */
|
||||||
|
actions : {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
18
rc-busness/store/modules/user.js
Normal file
18
rc-busness/store/modules/user.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
export default {
|
||||||
|
state : {
|
||||||
|
des : '这个存储用户数据的模块列表',
|
||||||
|
userInfo : {}, //用户信息
|
||||||
|
loginState : false, //登录状态
|
||||||
|
},
|
||||||
|
/* 存储修改状态的静态方法 */
|
||||||
|
mutations : {
|
||||||
|
/* 设置用户信息 */
|
||||||
|
SET_USER_INFO(state){
|
||||||
|
console.log(state);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* 存储修改数据的动态方法 */
|
||||||
|
actions : {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,8 @@
|
|||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"fastclick": "^1.0.6",
|
"fastclick": "^1.0.6",
|
||||||
|
"joi": "^17.6.0",
|
||||||
|
"join": "^3.0.0",
|
||||||
"js-cookie": "^2.2.1",
|
"js-cookie": "^2.2.1",
|
||||||
"lib-flexible": "^0.3.2",
|
"lib-flexible": "^0.3.2",
|
||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.20",
|
||||||
@ -27,19 +29,21 @@
|
|||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"regenerator-runtime": "^0.13.5",
|
"regenerator-runtime": "^0.13.5",
|
||||||
"vant": "^2.11.1",
|
"vant": "^2.11.1",
|
||||||
"vue": "^2.6.12",
|
"vue": "^3.2.31",
|
||||||
"vue-enum": "^1.0.5",
|
"vue-enum": "^1.0.5",
|
||||||
|
"vue-loader": "^17.0.0",
|
||||||
"vue-loading-overlay": "^3.4.2",
|
"vue-loading-overlay": "^3.4.2",
|
||||||
"vue-router": "^3.4.0",
|
"vue-router": "^3.4.0",
|
||||||
"vuex": "^3.6.0"
|
"vuex": "^3.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sentry/webpack-plugin": "^1.11.1",
|
"@sentry/webpack-plugin": "^1.18.8",
|
||||||
"@vue/cli-plugin-babel": "~4.5.0",
|
"@vue/cli-plugin-babel": "~4.5.0",
|
||||||
"@vue/cli-plugin-eslint": "~4.5.0",
|
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||||
"@vue/cli-plugin-router": "~4.5.0",
|
"@vue/cli-plugin-router": "~4.5.0",
|
||||||
"@vue/cli-plugin-vuex": "~4.5.0",
|
"@vue/cli-plugin-vuex": "~4.5.0",
|
||||||
"@vue/cli-service": "~4.5.0",
|
"@vue/cli-service": "~4.5.0",
|
||||||
|
"@vue/compiler-sfc": "^3.2.31",
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-plugin-import": "^1.13.0",
|
"babel-plugin-import": "^1.13.0",
|
||||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||||
|
@ -11,6 +11,9 @@ const projectConfig = require('./src/config/index.js');
|
|||||||
// 生产环境,测试和正式
|
// 生产环境,测试和正式
|
||||||
const isProductionEnv = ['production'].includes(process.env.NODE_ENV);
|
const isProductionEnv = ['production'].includes(process.env.NODE_ENV);
|
||||||
const isProductionAppEnv = ['prod', 'pre'].includes(process.env.VUE_APP_ENV);
|
const isProductionAppEnv = ['prod', 'pre'].includes(process.env.VUE_APP_ENV);
|
||||||
|
const addOptions = {
|
||||||
|
preserveWhitespace: true
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
publicPath: projectConfig.publicPath,
|
publicPath: projectConfig.publicPath,
|
||||||
@ -93,7 +96,7 @@ module.exports = {
|
|||||||
.use('vue-loader')
|
.use('vue-loader')
|
||||||
.loader('vue-loader')
|
.loader('vue-loader')
|
||||||
.tap(options => {
|
.tap(options => {
|
||||||
options.compilerOptions.preserveWhitespace = true;
|
options.compilerOptions = addOptions;
|
||||||
return options;
|
return options;
|
||||||
})
|
})
|
||||||
.end();
|
.end();
|
||||||
|
3
smart-admin-web/package-lock.json
generated
3
smart-admin-web/package-lock.json
generated
@ -4084,8 +4084,7 @@
|
|||||||
"core-js": {
|
"core-js": {
|
||||||
"version": "2.6.11",
|
"version": "2.6.11",
|
||||||
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.11.tgz?cache=0&sync_timestamp=1586450269267&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-2.6.11.tgz",
|
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.11.tgz?cache=0&sync_timestamp=1586450269267&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-2.6.11.tgz",
|
||||||
"integrity": "sha1-OIMUafmSK97Y7iHJ3EaYXgOZMIw=",
|
"integrity": "sha1-OIMUafmSK97Y7iHJ3EaYXgOZMIw="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"cropperjs": "^1.2.2",
|
"cropperjs": "^1.2.2",
|
||||||
"dayjs": "^1.7.7",
|
"dayjs": "^1.7.7",
|
||||||
"decimal.js": "^10.1.1",
|
"decimal.js": "^10.1.1",
|
||||||
"core-js":"^2.0.0",
|
"core-js": "^2.0.0",
|
||||||
"e-guide-layer": "^0.1.1",
|
"e-guide-layer": "^0.1.1",
|
||||||
"echarts": "^4.0.4",
|
"echarts": "^4.0.4",
|
||||||
"gq-plus": "^2.1.5",
|
"gq-plus": "^2.1.5",
|
||||||
|
Loading…
Reference in New Issue
Block a user