Merge branch 'dev1.0.0' into develop

msb_beta
ch 4 years ago
commit 66661a7f55

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-17 17:42:32 * @Date: 2022-03-17 17:42:32
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-04-29 18:11:28 * @LastEditTime: 2022-04-29 20:19:22
* @Description: 项目接口请求统一处理器,返回一个需要token和不需要token的请求封装方法 * @Description: 项目接口请求统一处理器,返回一个需要token和不需要token的请求封装方法
*/ */

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-04-25 14:39:19 * @Date: 2022-04-25 14:39:19
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-04-28 23:33:33 * @LastEditTime: 2022-04-29 20:19:36
* @Description: file content * @Description: file content
*/ */
import store from "../store"; import store from "../store";
@ -87,7 +87,7 @@ export let MsbWebSkt = null;
export const MsbWebSktInit = () => { export const MsbWebSktInit = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
MsbWebSkt = uni.connectSocket({ MsbWebSkt = uni.connectSocket({
url : `ws://192.168.10.92:8090/ws?client=${store.state.token}`, // url是websocket连接ip url : `ws://you-gateway.mashibing.com/ws?client=${store.state.token}`, // url是websocket连接ip
fail: e => { fail: e => {
reject(e) reject(e)
} }

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>马士兵严选</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) <!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>马士兵严选</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.a5c69d49.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.b5602bf5.js></script><script src=/static/js/index.c3f897b1.js></script></body></html> document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.a5c69d49.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.b5602bf5.js></script><script src=/static/js/index.792088ec.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -50,7 +50,7 @@
</view> </view>
</template> </template>
<view> <view v-if="item.status === 'notSku'">
<UiButton size="small" class="cart-item--reset-btn" type="line">重新选择</UiButton> <UiButton size="small" class="cart-item--reset-btn" type="line">重新选择</UiButton>
</view> </view>
</view> </view>
@ -66,7 +66,7 @@
<view v-if="list.length" :class="`footer footer__${type}`"> <view v-if="list.length" :class="`footer footer__${type}`">
<label class="all-radio" @click="handleCheckAll"> <label class="all-radio" @click="handleCheckAll">
<radio class="radio" color="#FF875B" <radio class="radio" color="#FF875B"
:checked="checkedIds.length > 0 && checkedIds.length === list.length" /> :checked="checkedIds.length > 0 && checkedIds.length === list.filter(i => i.status == 'normal').length" />
<text>全选</text> <text>全选</text>
</label> </label>
<view class="total-info" v-if="mode == 'normal'"> <view class="total-info" v-if="mode == 'normal'">
@ -115,8 +115,10 @@ export default {
isLoading: true, isLoading: true,
// 当前模式: normal正常 edit编辑 // 当前模式: normal正常 edit编辑
mode: 'normal', mode: 'normal',
// 购物车商品列表 // 购物车结算模式时商品列表,商品有notSku无SDK库存,正常normal 下架isDisable
list: [], settlementList : [],
// 购物车删除模式时的列表 ,所有商品状态为正常
delList : [],
// 购物车商品总数量 // 购物车商品总数量
total: null, total: null,
// 选中的商品ID记录 // 选中的商品ID记录
@ -134,6 +136,10 @@ export default {
} }
}, },
computed : { computed : {
// 根据模式最终显示的商品列表
list(){
return (this.mode === 'normal' ? this.settlementList : this.delList) || []
},
totalPrice(){ totalPrice(){
const checkedList = this.list.filter(item => this.checkedIds.includes(item.id)); const checkedList = this.list.filter(item => this.checkedIds.includes(item.id));
let tempPrice = 0; let tempPrice = 0;
@ -173,7 +179,7 @@ export default {
uni.$u.toast(error.message); uni.$u.toast(error.message);
return false; return false;
} }
this.list = result.map(item => { this.settlementList = result.map(item => {
const singleBuyLimit = item.product.singleBuyLimit; const singleBuyLimit = item.product.singleBuyLimit;
const stock = item.productSku.stock; const stock = item.productSku.stock;
const maxBuyNum = singleBuyLimit ? Math.min(singleBuyLimit, stock || 1) : stock const maxBuyNum = singleBuyLimit ? Math.min(singleBuyLimit, stock || 1) : stock
@ -185,6 +191,12 @@ export default {
maxBuyNum maxBuyNum
} }
}); });
this.delList = result.map(item => {
return {
...item,
status : 'normal'
}
})
this.onClearInvalidId(); this.onClearInvalidId();
this.isLoading = false; this.isLoading = false;
}, },
@ -259,11 +271,15 @@ export default {
/** /**
* 全选事件 * 全选事件
* 取到当前列表状态正常的商品列表。
* 如果选中IDS等于正常状态列表,则判断为取消全部
* 否则选中全部正常状态商品
*/ */
handleCheckAll() { handleCheckAll() {
const { checkedIds, list } = this; const { checkedIds, list } = this;
this.checkedIds = checkedIds.length === list.length ? [] : const normalList = list.filter(i => i.status == 'normal');
list.filter(i => i.status == 'normal').map(item => item.id); this.checkedIds = checkedIds.length === normalList.length ? [] :
normalList.map(item => item.id);
}, },
/** /**
@ -299,7 +315,9 @@ export default {
uni.$u.toast(error.message); uni.$u.toast(error.message);
return false; return false;
} }
this.list = this.list.filter(item => !ids.includes(item.id)); this.delList = this.delList.filter(item => !ids.includes(item.id));
this.settlementList = this.settlementList.filter(item => !ids.includes(item.id));
this.checkedIds = []; this.checkedIds = [];
this.onClearInvalidId(); this.onClearInvalidId();
} }

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-23 17:27:21 * @Date: 2022-03-23 17:27:21
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-04-29 17:01:20 * @LastEditTime: 2022-04-29 19:56:18
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -32,7 +32,7 @@
<view class="goods-desc"> <view class="goods-desc">
<mp-html :content="goods.detail"/> <mp-html :content="goods.detail"/>
</view> </view>
<view class="footer--not-stock" v-if="stock == 0">商品无库存啦~看看其他的吧</view> <view class="footer--not-stock" v-if="stock === 0">商品无库存啦~看看其他的吧</view>
<view class="footer"> <view class="footer">
<view class="footer--left"> <view class="footer--left">
<view class="icon service">客服</view> <view class="icon service">客服</view>
@ -58,6 +58,8 @@ export default {
components: { SlideImage, mpHtml, Service, SkuPopup, UiButton, SeckillPrice}, components: { SlideImage, mpHtml, Service, SkuPopup, UiButton, SeckillPrice},
data(){ data(){
return { return {
// 总库存,为了默认不提示无库存,默认值为1
stock : 1,
goods : { goods : {
pictureList : [] pictureList : []
}, },
@ -84,13 +86,6 @@ export default {
status = 'startActivity'; status = 'startActivity';
} }
return status; return status;
},
stock(){
let stock = 0;
this.skuInfoData.forEach(i => {
stock += i.stock
})
return stock
} }
}, },
onLoad(){ onLoad(){
@ -125,6 +120,11 @@ export default {
return false; return false;
} }
this.skuInfoData = result; this.skuInfoData = result;
// 设置总库存
this.stock = 0;
this.skuInfoData.forEach(i => {
this.stock += i.stock
})
}, },
/** /**
* 显示/隐藏SKU弹窗 * 显示/隐藏SKU弹窗

Loading…
Cancel
Save