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": 2,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
¥
|
||||
</i>
|
||||
<span>
|
||||
{{ item.couponAmount?item.couponAmount:(parseInt((1-item.discount)*10)+'折') }}
|
||||
{{ item.couponAmount?item.couponAmount:(parseInt(10 - item.discount*10)+'折') }}
|
||||
</span>
|
||||
</div>
|
||||
<strong>{{ item.couponName }}</strong>
|
||||
|
@ -167,7 +167,7 @@
|
||||
¥
|
||||
</i>
|
||||
<span>
|
||||
{{ item.couponAmount?item.couponAmount:(parseInt((1-item.discount)*10)+'折') }}
|
||||
{{ item.couponAmount?item.couponAmount:(parseInt(10 - item.discount*10)+'折') }}
|
||||
</span>
|
||||
</div>
|
||||
<strong>{{ item.couponName }}</strong>
|
||||
@ -268,7 +268,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(["checkIsLogin"]),
|
||||
/* 计算优惠券价格 */
|
||||
discountedSumPrice() {
|
||||
/* 判断是否为商品卷 */
|
||||
if(this.curCoupon.productCodes)
|
||||
this.finalAmount = this.qualifiedProductDiscount();
|
||||
else
|
||||
@ -309,15 +311,17 @@ export default {
|
||||
return this.sumPrice;
|
||||
}
|
||||
},
|
||||
/* 计算价格商品折扣 */
|
||||
qualifiedProductDiscount(){
|
||||
this.discountedItemIndex = 0;
|
||||
let total = 0;
|
||||
let totalItemNum = 0;
|
||||
let totalItemNum = 0; //判断满足优惠券条件的商品数量
|
||||
let couponUsed = false;
|
||||
let tmpShoppingCartList = this.arrSort(this.goldmedal);
|
||||
let qualifiedProductAmount = 0;
|
||||
let tmpShoppingCartList = this.arrSort(this.goldmedal); //对应的商品
|
||||
let qualifiedProductAmount = 0; //满足条件的优惠券商品价格总价
|
||||
let skipQualifiedProductAmountCalculating = false;
|
||||
let checkResult = true;
|
||||
let checkResult = true; //是否可使用
|
||||
let selectProduct = []; //满足条件的商品
|
||||
for(let itemInCart of tmpShoppingCartList) {
|
||||
if(this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) {
|
||||
qualifiedProductAmount += (itemInCart.productPrice * itemInCart.buyCount);
|
||||
@ -334,8 +338,17 @@ export default {
|
||||
checkResult = false;
|
||||
}
|
||||
|
||||
|
||||
// couponTypeId
|
||||
// 0-不用折扣
|
||||
// 1-狗干粮金额券(50)
|
||||
// 2-通用金额满减券(50)
|
||||
// 3-通用折扣券(6折)
|
||||
// 4-指定干粮折扣券(7折)
|
||||
// 6-指定干粮金额券(100)
|
||||
for(let itemInCart of tmpShoppingCartList) {
|
||||
if(this.curCoupon.productCodes && this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1 && !couponUsed && checkResult) {
|
||||
console.log(itemInCart,'itemInCart');
|
||||
//Into coupon discount calculation
|
||||
switch(this.curCoupon.couponTypeId) {
|
||||
case 1: //Amount deduct
|
||||
@ -369,8 +382,8 @@ export default {
|
||||
case 3: //Limited product % discount
|
||||
case 4: //% discount
|
||||
if(this.curCoupon.discount && this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) {
|
||||
total = total + (itemInCart.productPrice * itemInCart.buyCount) * ( 1 - this.curCoupon.discount );
|
||||
this.discountAmount = (itemInCart.productPrice * itemInCart.buyCount) * this.curCoupon.discount;
|
||||
total = total + qualifiedProductAmount * ( 1 - this.curCoupon.discount );
|
||||
this.discountAmount = qualifiedProductAmount * this.curCoupon.discount;
|
||||
this.discountedProductCode = itemInCart.productCode;
|
||||
couponUsed=true;
|
||||
skipQualifiedProductAmountCalculating = true;
|
||||
@ -517,6 +530,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 关闭弹出框 计算价格 */
|
||||
pickCoupon(item){
|
||||
this.curCoupon = item;
|
||||
this.dialogInfo1 = false;
|
||||
|
@ -281,6 +281,9 @@ export default {
|
||||
for (let y = 0; y < this.goldmedal.length; y++) {
|
||||
if(!this.goldmedal[y].orderDetailList)
|
||||
continue;
|
||||
if(!this.useralllist[y]){
|
||||
this.useralllist[y] = {};
|
||||
}
|
||||
this.useralllist[y].orderNumber = this.goldmedal[y].orderNumber;
|
||||
this.useralllist[y].status = this.goldmedal[y].status;
|
||||
this.useralllist[y].addressUserName = this.goldmedal[y].addressUserName;
|
||||
@ -353,12 +356,13 @@ export default {
|
||||
type: "warning",
|
||||
message: "取消订单成功",
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.indet(this.userdata);
|
||||
this.activeIndex=0;
|
||||
this.useralllist=[];
|
||||
}, 500);
|
||||
|
||||
/* 这个在全部变量去除的时候 记得加 */
|
||||
// setTimeout(() => {
|
||||
// this.indet(this.userdata);
|
||||
// this.activeIndex=0;
|
||||
// this.useralllist=[];
|
||||
// console.log('2222');
|
||||
// }, 500);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -237,7 +237,8 @@
|
||||
¥
|
||||
</i>
|
||||
<span>
|
||||
{{ item.couponAmount?item.couponAmount:(parseInt((1-item.discount)*10)+'折') }}
|
||||
<!-- 不合并 因为0.1计算器不是0.1 -->
|
||||
{{ item.couponAmount?item.couponAmount:(parseInt(10 - item.discount*10)+'折') }}
|
||||
</span>
|
||||
</div>
|
||||
<strong>{{ item.couponName }}</strong>
|
||||
|
@ -143,7 +143,7 @@
|
||||
|
||||
<script>
|
||||
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 Myheader from "~/components/header.vue"; //引用头部公共组件
|
||||
export default {
|
||||
@ -218,15 +218,19 @@ export default {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
...mapState({
|
||||
userInfo : state => state.user.userInfo,
|
||||
})
|
||||
},
|
||||
mounted() {
|
||||
//console.log(this.$route.params);
|
||||
this.checkIsLogin();
|
||||
let user = this.$store.state.userInfo;
|
||||
if(user) {
|
||||
this.$router.push({
|
||||
path: "/personal/mypersonal",
|
||||
});
|
||||
if(user || this.userInfo) {
|
||||
console.log('333');
|
||||
// this.$router.push({
|
||||
// path: "/personal/mypersonal",
|
||||
// });
|
||||
}
|
||||
},
|
||||
// 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 = () => ({
|
||||
// 这里是全局数据保存的地方
|
||||
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",
|
||||
"core-js": "^3.6.5",
|
||||
"fastclick": "^1.0.6",
|
||||
"joi": "^17.6.0",
|
||||
"join": "^3.0.0",
|
||||
"js-cookie": "^2.2.1",
|
||||
"lib-flexible": "^0.3.2",
|
||||
"lodash": "^4.17.20",
|
||||
@ -27,19 +29,21 @@
|
||||
"nprogress": "^0.2.0",
|
||||
"regenerator-runtime": "^0.13.5",
|
||||
"vant": "^2.11.1",
|
||||
"vue": "^2.6.12",
|
||||
"vue": "^3.2.31",
|
||||
"vue-enum": "^1.0.5",
|
||||
"vue-loader": "^17.0.0",
|
||||
"vue-loading-overlay": "^3.4.2",
|
||||
"vue-router": "^3.4.0",
|
||||
"vuex": "^3.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sentry/webpack-plugin": "^1.11.1",
|
||||
"@sentry/webpack-plugin": "^1.18.8",
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||
"@vue/cli-plugin-router": "~4.5.0",
|
||||
"@vue/cli-plugin-vuex": "~4.5.0",
|
||||
"@vue/cli-service": "~4.5.0",
|
||||
"@vue/compiler-sfc": "^3.2.31",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-plugin-import": "^1.13.0",
|
||||
"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 isProductionAppEnv = ['prod', 'pre'].includes(process.env.VUE_APP_ENV);
|
||||
const addOptions = {
|
||||
preserveWhitespace: true
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
publicPath: projectConfig.publicPath,
|
||||
@ -93,7 +96,7 @@ module.exports = {
|
||||
.use('vue-loader')
|
||||
.loader('vue-loader')
|
||||
.tap(options => {
|
||||
options.compilerOptions.preserveWhitespace = true;
|
||||
options.compilerOptions = addOptions;
|
||||
return options;
|
||||
})
|
||||
.end();
|
||||
|
3
smart-admin-web/package-lock.json
generated
3
smart-admin-web/package-lock.json
generated
@ -4084,8 +4084,7 @@
|
||||
"core-js": {
|
||||
"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",
|
||||
"integrity": "sha1-OIMUafmSK97Y7iHJ3EaYXgOZMIw=",
|
||||
"dev": true
|
||||
"integrity": "sha1-OIMUafmSK97Y7iHJ3EaYXgOZMIw="
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -23,7 +23,7 @@
|
||||
"cropperjs": "^1.2.2",
|
||||
"dayjs": "^1.7.7",
|
||||
"decimal.js": "^10.1.1",
|
||||
"core-js":"^2.0.0",
|
||||
"core-js": "^2.0.0",
|
||||
"e-guide-layer": "^0.1.1",
|
||||
"echarts": "^4.0.4",
|
||||
"gq-plus": "^2.1.5",
|
||||
|
Loading…
Reference in New Issue
Block a user