Merge branch 'feat-Unite-wtt' into feat-Unite-jialan

# Conflicts:
#	.env
#	config/host.js
#	project.config.json
#	src/ext.json
#	src/pages/cart/espier-checkout.js
#	src/pages/index.js
#	src/pages/item/espier-detail.js
This commit is contained in:
[wangtengteng]
2020-11-27 18:12:51 +08:00
21 changed files with 2762 additions and 141 deletions

View File

@@ -1,13 +1,13 @@
module.exports = {
h5: {
prod: 'ecshopx1.shopex123.com/index.php',
preissue: 'ecshopx1.shopex123.com/index.php',
test: 'ecshopx1.shopex123.com/index.php'
prod: 'ecshopx.shopex123.com/index.php',
preissue: 'ecshopx.shopex123.com/index.php',
test: 'ecshopx.shopex123.com/index.php'
},
weapp: {
prod: 'ecshopx1.shopex123.com/index.php',
preissue: 'ecshopx1.shopex123.com/index.php',
test: 'ecshopx1.shopex123.com/index.php'
prod: 'ecshopx.shopex123.com/index.php',
preissue: 'ecshopx.shopex123.com/index.php',
test: 'ecshopx.shopex123.com/index.php'
},
websocket: {
development: 'wss://ecshopx.shopex123.com/ws',

View File

@@ -17,11 +17,12 @@ export function add (params) {
}
export function fastBuy (params) {
const { item_id, num = 1, bargain_id } = params
const { item_id, num = 1, bargain_id,distributor_id } = params
const query = {
cart_type: 'fastbuy',
item_id,
num,
distributor_id,
isAccumulate: false,
shop_type: 'distributor'
}

View File

@@ -7,3 +7,7 @@ export function getShop (params = {}) {
export function list (params = {}) {
return req.get('/distributor/list', params)
}
export function getStoreStatus (params = {}) {
return req.get('/nostores/getstatus', params)
}

View File

@@ -97,6 +97,7 @@ class App extends Component {
'pages/store/index',
'pages/store/list',
'pages/store/ziti-list',
'pages/custom/custom-page'
],
@@ -163,10 +164,10 @@ class App extends Component {
'pages/plusprice/cart-plusprice-list',
],
"plugins": {
"live-player-plugin": {
"version": "1.2.3", // 填写该直播组件版本号
"provider": "wx2b03c6e691cd7370" // 必须填该直播组件appid
}
// "live-player-plugin": {
// "version": "1.2.3", // 填写该直播组件版本号
// "provider": "wx2b03c6e691cd7370" // 必须填该直播组件appid
// }
// "meiqia": {
// "version": "1.1.0",
// "provider": "wx2d2cd5fd79396601"

View File

@@ -9,6 +9,7 @@ import InputNumber from "@/components/input-number";
import { classNames, pickBy, log } from "@/utils";
import { Tracker } from "@/service";
import api from "@/api";
import entry from '@/utils/entry'
import "./index.scss";
@@ -273,12 +274,15 @@ export default class GoodsBuyPanel extends Component {
handleBuyClick = async (type, skuInfo, num) => {
console.warn(this.props);
if (this.state.busy) return;
const isOpenStore = await entry.getStoreStatus()
const { marketing, info } = this.props;
const { special_type } = info;
const isDrug = special_type === "drug";
const { item_id } = this.noSpecs ? info : skuInfo;
const { distributor_id } = info;
const curStore = Taro.getStorageSync('curStore');
//let id = isOpenStore ? curStore.store_id: curStore.distributor_id
let id = isOpenStore ? curStore.store_id : distributor_id
let url = `/pages/cart/espier-checkout`;
this.setState({
@@ -292,7 +296,7 @@ export default class GoodsBuyPanel extends Component {
await api.cart.add({
item_id,
num,
distributor_id,
distributor_id:id,
shop_type: isDrug ? "drug" : "distributor"
});
Taro.showToast({
@@ -323,7 +327,7 @@ export default class GoodsBuyPanel extends Component {
}
if (type === "fastbuy") {
url += `?cart_type=fastbuy&shop_id=${distributor_id}`;
url += `?cart_type=fastbuy&shop_id=${id}`;
if (marketing === "group") {
const { groups_activity_id } = info.activity_info;
url += `&type=${marketing}&group_id=${groups_activity_id}`;
@@ -348,7 +352,7 @@ export default class GoodsBuyPanel extends Component {
await api.cart.fastBuy({
item_id,
num,
distributor_id
distributor_id:id
});
} catch (e) {
console.log(e);

View File

@@ -36,6 +36,7 @@ import PointUse from "./comps/point-use";
import OrderItem from "../../components/orderItem/order-item";
import "./espier-checkout.scss";
import entry from "../../utils/entry";
const transformCartList = list => {
return pickBy(list, {
@@ -60,7 +61,8 @@ const transformCartList = list => {
address: address.current,
coupon: cart.coupon,
drugInfo: cart.drugInfo,
colors: colors.current
colors: colors.current,
zitiShop:cart.zitiShop
}),
dispatch => ({
onClearFastbuy: () => dispatch({ type: "cart/clearFastbuy" }),
@@ -70,7 +72,9 @@ const transformCartList = list => {
onAddressChoose: address =>
dispatch({ type: "address/choose", payload: address }),
onChangeCoupon: coupon =>
dispatch({ type: "cart/changeCoupon", payload: coupon })
dispatch({ type: "cart/changeCoupon", payload: coupon }),
onChangeZitiStore: zitiShop =>
dispatch({ type:"cart/changeZitiStore",payload:zitiShop})
//onChangeDrugInfo: (drugInfo) => dispatch({ type: 'cart/changeDrugInfo', payload: drugInfo })
})
)
@@ -130,7 +134,8 @@ export default class CartCheckout extends Component {
isPackage:false,
isPackageOpen:false,
isNeedPackage: false,
pick:{}
pick:{},
isOpenStore:null
};
}
@@ -230,6 +235,8 @@ export default class CartCheckout extends Component {
this.props.onAddressChoose(null);
this.props.onChangeZitiStore(null);
Taro.removeStorageSync('selectShop')
this.getSalespersonNologin();
this.tradeSetting()
// this.getShop()
@@ -241,12 +248,15 @@ export default class CartCheckout extends Component {
if (nextProps.address !== this.props.address) {
this.fetchAddress();
}
if(nextProps.zitiShop !== this.props.zitiShop){
this.fetchZiTiShop();
}
}
componentWillUnmount () {
// teardown clean
this.props.onClearCoupon();
this.props.onClearDrugInfo();
Taro.removeStorageSync('selectShop');
}
componentDidShow () {
@@ -266,20 +276,63 @@ export default class CartCheckout extends Component {
}
}
async fetchZiTiShop () {
const { shop_id, scene } = this.$router.params;
// const {curStore} = this.state
// const shopInfo = await api.shop.getShop({distributor_id: shop_id})
async fetchZiTiShop() {
const { shop_id, scene,cart_type,seckill_id = null,ticket = null,order_type} = this.$router.params;
//const { zitiShop } = this.props;
const params = this.getParams()
const selectShop = Taro.getStorageSync('selectShop')
let id = shop_id;
let ztparams ={}
if (scene) {
const { dtid } = normalizeQuerys(this.$router.params);
id = dtid;
}
const shopInfo = await api.shop.getShop({ distributor_id: id });
const isOpenStore = await entry.getStoreStatus()
this.setState({
isOpenStore
})
if(isOpenStore) {//是否开启非门店自提
ztparams = {
isNostores: 1,//1 开启
order_type : params.order_type,
cart_type,
seckill_id: seckill_id,
seckill_ticket: ticket,
}
if(selectShop){
ztparams = {
...ztparams,
distributor_id:selectShop.distributor_id,
}
}else {
let lnglat = Taro.getStorageSync('lnglat')
ztparams = {
...ztparams,
lat: lnglat.latitude,
lng:lnglat.longitude,
cart_type: cart_type,
}
}
} else {
ztparams ={
isNostores: 0//0 未开启
}
if(!selectShop){
ztparams ={
...ztparams,
distributor_id: id
}
}
}
const shopInfo = await api.shop.getShop(ztparams);
isOpenStore && Taro.setStorageSync('selectShop',shopInfo)
this.setState({
curStore: shopInfo,
receiptType: shopInfo.is_delivery ? "logistics" : "ziti",
express: shopInfo.is_delivery ? true : false
receiptType: selectShop ? 'ziti' : shopInfo.is_delivery ? "logistics" : "ziti",
express: selectShop ? false : shopInfo.is_delivery ? true : false,
},()=>{
isOpenStore && this.calcOrder()
});
}
@@ -500,15 +553,16 @@ export default class CartCheckout extends Component {
monitor_id: trackParams.monitor_id
};
}
const distributionShopId = Taro.getStorageSync("distribution_shop_id");
const distributionShopId = Taro.getStorageSync("distribution_shop_id")
const curStorageStore = Taro.getStorageSync('curStore')
let miniShopId = {};
if (distributionShopId) {
miniShopId = {
promoter_shop_id: distributionShopId
};
}
const { payType, receiptType, point_use } = this.state;
const { coupon, drugInfo } = this.props;
const { payType, receiptType, point_use,isOpenStore,curStore } = this.state;
const { coupon, drugInfo,zitiShop } = this.props;
if (drugInfo) {
this.setState({
drug: drugInfo
@@ -527,8 +581,17 @@ export default class CartCheckout extends Component {
member_discount: 0,
coupon_discount: 0,
pay_type: payType,
distributor_id:
this.getShopId() || (shop_id === "undefined" ? 0 : shop_id),
isNostores: isOpenStore ? 1 : 0,
//distributor_id:this.getShopId() || (shop_id === "undefined" ? 0 : shop_id),
distributor_id:isOpenStore
? receiptType === 'logistics'
? curStorageStore.store_id
: zitiShop
? zitiShop.distributor_id
: curStore
? curStore.distributor_id
: this.getShopId() || (shop_id === "undefined" ? 0 : shop_id)
: this.getShopId() || (shop_id === "undefined" ? curStorageStore.distributor_id : shop_id),
...drugInfo,
point_use: point_use
};
@@ -760,6 +823,13 @@ export default class CartCheckout extends Component {
scale: 18
});
};
handleEditZitiClick =(id) =>{
const {cart_type,seckill_id = null,ticket = null,goodType} = this.$router.params;
const params = this.getParams()
Taro.navigateTo({
url: `/pages/store/ziti-list?shop_id=${id}&cart_type=${cart_type}&order_type=${params.order_type}&seckill_id=${seckill_id}&ticket=${ticket}&goodType=${goodType}`
})
}
handleShippingChange = type => {
console.log(type);
@@ -953,9 +1023,9 @@ export default class CartCheckout extends Component {
// if (!this.state.address) {
// return S.toast('请选择地址')
// }
const { payType, total, identity } = this.state;
const { payType, total, identity,isOpenStore,curStore,receiptType } = this.state;
const { type, goodType, cart_type } = this.$router.params;
// const { payType, total,point_use } = this.state
// const { type } = this.$router.params
const isDrug = type === "drug";
@@ -1000,10 +1070,9 @@ export default class CartCheckout extends Component {
try {
let params = this.getParams();
if (APP_PLATFORM === "standard" && cart_type !== "cart") {
const { distributor_id } = Taro.getStorageSync("curStore");
params.distributor_id = this.getShopId() || distributor_id;
const { distributor_id,store_id } = Taro.getStorageSync("curStore");
params.distributor_id = isOpenStore ? receiptType === 'ziti' ? curStore.distributor_id : store_id : this.getShopId() || distributor_id;
}
delete params.items;
// 积分不开票
if (payType === "point") {
@@ -1016,7 +1085,7 @@ export default class CartCheckout extends Component {
if (salesman_id) {
params.salesman_id = salesman_id;
}
// 如果是跨境商品
if (goodType === "cross") {
if (!identity.identity_id || !identity.identity_name) {
@@ -1401,7 +1470,8 @@ export default class CartCheckout extends Component {
quota_tip,
isNeedPackage,
isPackage,
pack
pack,
isOpenStore
} = this.state;
// let curStore = {}
// if (shopData) {
@@ -1425,7 +1495,6 @@ export default class CartCheckout extends Component {
: (coupon.value && coupon.value.title) || "";
//const isBtnDisabled = !address
const isBtnDisabled = express ? !address : false;
return (
<View className="page-checkout">
{showAddressPicker === false ? (
@@ -1467,22 +1536,29 @@ export default class CartCheckout extends Component {
</View>
)}
{bargain_id ||
(express && curStore && curStore.is_delivery) ||
(curStore && !curStore.is_delivery && !curStore.is_ziti) ||
goodType === "cross" ? (
<AddressChoose isAddress={address} />
) : (
<View className="address-module">
<View className="addr">
<View className="view-flex-item">
<View className="addr-title">{curStore.name}</View>
<View className="addr-detail">{curStore.store_address}</View>
</View>
<View
className="icon-location"
onClick={this.handleMapClick.bind(this)}
></View>
(express && curStore && curStore.is_delivery) ||
(curStore && !curStore.is_delivery && !curStore.is_ziti) ||
goodType === "cross" ? (
<AddressChoose isAddress={address} />
) : (
<View className="address-module">
<View className="addr">
<View className="view-flex-item">
<View className="addr-title">{curStore.name}</View>
<View className="addr-detail">{curStore.store_address}</View>
</View>
{
isOpenStore
?<View
className="icon-edit"
onClick={this.handleEditZitiClick.bind(this,curStore.distributor_id)}>
</View>
:<View
className="icon-location"
onClick={this.handleMapClick.bind(this)}
></View>
}
</View>
<View className="view-flex">
<View className="view-flex-item">
<View className="text-muted">营业时间</View>

View File

@@ -98,6 +98,9 @@
color: #666;
}
}
.icon-edit{
color: #D0021B !important;
}
}
.sec-checkout-items {

View File

@@ -10,6 +10,7 @@ import S from '@/spx'
import { Tracker } from "@/service";
import { withPager } from '@/hocs'
import CartItem from './comps/cart-item'
import entry from '@/utils/entry'
import './espier-index.scss'
@@ -216,8 +217,10 @@ export default class CartIndex extends Component {
let valid_cart = [], invalid_cart = [], crossborder_show = false
const cartTypeLocal = Taro.getStorageSync('cartType')
const { type = 'distributor' } = this.$router.params
const isOpenStore = await entry.getStoreStatus()//非门店自提
const params = {
shop_type: type
shop_type: type,
isNostores: isOpenStore ? 1 : 0//是否开启非门店自提流程
}
if (cartTypeLocal === 'cross') {
params.iscrossborder = 1

1849
src/pages/cart/wtt.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -65,7 +65,6 @@ export default class WgtGoodsGrid extends Component {
}
const { base, data, config } = info
console.log(info, 31)
/*let listData = []
data.map(item => {
listData.push({

View File

@@ -70,18 +70,22 @@ export default class HeaderHome extends Component {
}
render () {
const { store, isOpenScanQrcode } = this.props
const { store, isOpenScanQrcode,isOpenStoreStatus } = this.props
const isNoStores = isOpenStoreStatus ? false : true
return (
<View className='home-header'>
{
store.name &&
<View className='nearly-shop'>
<View className='shop-view view-flex-item view-flex view-flex-middle' onClick={this.handlePickStore.bind(this)}>
<View className='icon-periscope'></View>
<View className='shop-name'>{store.name || '选择店铺'}</View>
<View className='icon-arrowDown'></View>
</View>
{
isNoStores && store.name && (
<View className='shop-view view-flex-item view-flex view-flex-middle' onClick={this.handlePickStore.bind(this)}>
<View className='icon-periscope'></View>
<View className='shop-name'>{store.name || '选择店铺'}</View>
<View className='icon-arrowDown'></View>
</View>
)
}
{
Taro.getEnv() !== 'WEB' && isOpenScanQrcode==1 && <View className='scancode' onClick={this.handleScanCode.bind(this)}>
<View className='iconfont icon-scan'></View>
@@ -89,7 +93,6 @@ export default class HeaderHome extends Component {
</View>
}
</View>
}
</View>
)
}

View File

@@ -53,6 +53,7 @@ export default class HomeIndex extends Component {
is_open_recommend: null,
is_open_scan_qrcode: null,
is_open_official_account:null,
is_open_store_status:null,
show_official:true,
showCloseBtn:false,
// 是否有跳转至店铺页
@@ -76,6 +77,10 @@ export default class HomeIndex extends Component {
// })
// // const res = parseUrlStr(queryStr)
// }
const isOpenStore = await entry.getStoreStatus()
this.setState({
is_open_store_status:isOpenStore
})
this.checkWhite()
//this.fetchSetInfo()
api.wx.shareSetting({shareindex: 'index'}).then(res => {
@@ -92,22 +97,23 @@ export default class HomeIndex extends Component {
is_open_recommend: is_open_recommend,
is_open_scan_qrcode: is_open_scan_qrcode,
is_open_wechatapp_location: is_open_wechatapp_location,
is_open_official_account:is_open_official_account
is_open_official_account:is_open_official_account,
}, async() => {
let isNeedLoacate = is_open_wechatapp_location == 1 ? true : false
const options = this.$router.params
const res = await entry.entryLaunch(options, isNeedLoacate)
const { store } = res
if (!isArray(store)) {
this.setState({
curStore: store
}, () => {
this.fetchData()
})
}
let isNeedLoacate = is_open_wechatapp_location == 1 ? true : false
const options = this.$router.params
const res = await entry.entryLaunch(options, isNeedLoacate)
const { store } = res
if (!isArray(store)) {
this.setState({
curStore: store
}, () => {
this.fetchData()
})
}
})
}
fetchData() {
this.fetchInfo(async () => {
// const url = '/pageparams/setting?template_name=yykweishop&version=v1.0.1&page_name=index&name=search'
@@ -137,13 +143,16 @@ export default class HomeIndex extends Component {
componentDidShow = () => {
const options = this.$router.params
const { curStore } = this.state
const { curStore,is_open_store_status } = this.state
const curStoreLocal = Taro.getStorageSync('curStore')
const localdis_id = curStoreLocal && is_open_store_status ? curStoreLocal.store_id : curStoreLocal.distributor_id //非自提门店判断
//const curdis_id = curStore && curStore.isNostores == 1 ? curStore.store_id : curStore.distributor_id
if (!isArray(curStoreLocal) && this.state.isGoStore) {
this.setState({
isGoStore: false
})
if (!curStore || (curStoreLocal.distributor_id != curStore.distributor_id) ) {
if (!curStore || (localdis_id != curStore.distributor_id) ) {
this.setState({
curStore: curStoreLocal,
likeList: [],
@@ -302,12 +311,13 @@ export default class HomeIndex extends Component {
}
}
async fetchInfo(cb) {
const { curStore } = this.state
const { curStore,is_open_store_status } = this.state
const curdis_id = curStore && is_open_store_status ? curStore.store_id : curStore.distributor_id
if (!curStore.distributor_id && curStore.distributor_id !== 0) {
return
}
// const url = '/pageparams/setting?template_name=yykweishop&version=v1.0.1&page_name=index'
const url = '/pagestemplate/detail?template_name=yykweishop&weapp_pages=index&distributor_id=' + curStore.distributor_id
const url = '/pagestemplate/detail?template_name=yykweishop&weapp_pages=index&distributor_id=' + curdis_id
const info = await req.get(url)
this.setState({
wgts: isArray(info) ? [] : info.config
@@ -457,7 +467,7 @@ export default class HomeIndex extends Component {
}
render () {
const { wgts, page, likeList, showBackToTop, isShowAddTip, curStore, positionStatus, automatic, showAuto, featuredshop, is_open_recommend, is_open_scan_qrcode,is_open_official_account,show_official,showCloseBtn,show_tabBar } = this.state
const { wgts, page, likeList, showBackToTop, isShowAddTip, curStore, positionStatus, automatic, showAuto, featuredshop, is_open_recommend, is_open_scan_qrcode,is_open_official_account,show_official,showCloseBtn,show_tabBar,is_open_store_status } = this.state
// const { showLikeList } = this.props
// const user = Taro.getStorageSync('userinfo')
// const isPromoter = user && user.isPromoter
@@ -467,7 +477,7 @@ export default class HomeIndex extends Component {
if (!this.props.store) {
return <Loading />
}
// const show_location = wgts.find(item=>item.name=='setting'&&item.config.location)
// const show_location = wgts.find(item=>item.name=='setting'&&item.config.location)
return (
<View className='page-index'>
{
@@ -486,6 +496,7 @@ export default class HomeIndex extends Component {
store={curStore}
onClickItem={this.goStore.bind(this)}
isOpenScanQrcode={is_open_scan_qrcode}
isOpenStoreStatus={is_open_store_status}
/>
}

View File

@@ -67,7 +67,8 @@ export default class Detail extends Component {
evaluationList: [],
evaluationTotal: 0,
// 是否订阅
isSubscribeGoods: false
isSubscribeGoods: false,
is_open_store_status:null,
}
}
@@ -75,25 +76,37 @@ export default class Detail extends Component {
const options = this.$router.params
let id = options.id
let uid = ''
if (APP_PLATFORM === 'standard') {
const { distributor_id } = Taro.getStorageSync('curStore')
if (!options.dtid || options.dtid !== 0) {
options.dtid = distributor_id
const isOpenStore = await entry.getStoreStatus()
this.setState({
is_open_store_status:isOpenStore
},async()=>{
if (APP_PLATFORM === 'standard') {
const { is_open_store_status } = this.state
// const { distributor_id } = Taro.getStorageSync('curStore')
const curStore = Taro.getStorageSync('curStore')
if(is_open_store_status){
if (!options.dtid || options.dtid !== 0) {
options.dtid = curStore.distributor_id
}
}else{
delete options.dtid
}
const entryData = await entry.entryLaunch(options, true)
id = entryData.id
uid = entryData.uid
}
const entryData = await entry.entryLaunch(options, true)
id = entryData.id
uid = entryData.uid
}
if (uid) {
this.uid = uid
}
if (options.scene) {
const query = normalizeQuerys(options)
if (query.id) {
id = query.id
uid = query.uid
if (uid) {
this.uid = uid
}
}
if (options.scene) {
const query = normalizeQuerys(options)
if (query.id) {
id = query.id
uid = query.uid
}
}
})
if(!S.getAuthToken()){
this.checkWhite()
}
@@ -113,7 +126,6 @@ export default class Detail extends Component {
console.log(e)
}
}
// 处理定位
const lnglat = Taro.getStorageSync('lnglat')
if (lnglat && !lnglat.city) {
@@ -171,10 +183,11 @@ export default class Detail extends Component {
onShareAppMessage() {
const { info } = this.state
const { distributor_id } = Taro.getStorageSync('curStore')
const curStore = Taro.getStorageSync('curStore')
const { userId } = Taro.getStorageSync('userinfo')
const infoId = info.distributor_id
const id = APP_PLATFORM === 'standard' ? distributor_id : infoId
const { is_open_store_status} = this.state
const id = APP_PLATFORM === 'standard' ? is_open_store_status ? curStore.store_id: curStore.distributor_id : infoId
Tracker.dispatch("GOODS_SHARE_TO_CHANNEL_CLICK", {
...info,
shareType: "分享给好友"
@@ -188,10 +201,11 @@ export default class Detail extends Component {
onShareTimeline() {
const { info } = this.state
const { distributor_id } = Taro.getStorageSync('curStore')
const curStore = Taro.getStorageSync('curStore')
const { userId } = Taro.getStorageSync('userinfo')
const { is_open_store_status} = this.state
const infoId = info.distributor_id
const id = APP_PLATFORM === 'standard' ? distributor_id : infoId
const id = APP_PLATFORM === 'standard' ? is_open_store_status ? curStore.store_id: curStore.distributor_id : infoId
return {
title: info.item_name,
query: `id=${info.item_id}&dtid=${id}&uid=${userId}`,
@@ -224,7 +238,8 @@ export default class Detail extends Component {
}
async fetchInfo(itemId, goodsId) {
const { distributor_id } = Taro.getStorageSync('curStore')
const { distributor_id,store_id } = Taro.getStorageSync('curStore')
const { is_open_store_status } = this.state
let id = ''
if (itemId) {
id = itemId
@@ -235,21 +250,20 @@ export default class Detail extends Component {
const param = { goods_id: goodsId }
if (APP_PLATFORM === 'standard') {
param.distributor_id = distributor_id 
param.distributor_id = is_open_store_status ? store_id : distributor_id 
} else {
if (this.$router.params.dtid) {
param.distributor_id  = this.$router.params.dtid
param.distributor_id  = is_open_store_status ? store_id : this.$router.params.dtid
} else {
const options = this.$router.params
if (options.scene) {
const query = normalizeQuerys(options)
if (query.dtid) {
param.distributor_id  = query.dtid
param.distributor_id = is_open_store_status ? store_id : query.dtid
}
}
}
}
// 商品详情
const info = await api.item.detail(id, param)
// 是否订阅
@@ -458,10 +472,12 @@ export default class Detail extends Component {
}
handlePackageClick = () => {
const { info } = this.state
const { info,is_open_store_status } = this.state
let { distributor_id } = info
const curStore = Taro.getStorageSync('curStore')
if (APP_PLATFORM === 'standard') {
distributor_id = Taro.getStorageSync('curStore').distributor_id
//distributor_id = Taro.getStorageSync('curStore').distributor_id
distributor_id = is_open_store_status ? curStore.store_id : curStore.distributor_id
}
Taro.navigateTo({
url: `/pages/item/package-list?id=${info.item_id}&distributor_id=${distributor_id}`
@@ -526,14 +542,14 @@ export default class Detail extends Component {
userinfo = userObj
}
const { avatar, userId } = userinfo
const { info } = this.state
const { info,is_open_store_status } = this.state
const { pics, company_id, item_id } = info
const host = req.baseURL.replace('/api/h5app/wxapp/', '')
const extConfig = (Taro.getEnv() === 'WEAPP' && wx.getExtConfigSync) ? wx.getExtConfigSync() : {}
const { distributor_id } = Taro.getStorageSync('curStore')
const { distributor_id,store_id } = Taro.getStorageSync('curStore')
const pic = pics[0].replace('http:', 'https:')
const infoId = info.distributor_id
const id = APP_PLATFORM === 'standard' ? distributor_id : infoId
const id = APP_PLATFORM === 'standard' ? is_open_store_status ? store_id : distributor_id : infoId
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=${`pages/item/espier-detail`}&appid=${extConfig.appid}&company_id=${company_id}&id=${item_id}&dtid=${id}&uid=${userId}`
const avatarImg = await Taro.getImageInfo({src: avatar})
const goodsImg = await Taro.getImageInfo({src: pic})
@@ -728,7 +744,9 @@ export default class Detail extends Component {
}
handleClickItem = (item) => {
const id = APP_PLATFORM === 'standard' ? Taro.getStorageSync('curStore').distributor_id : item.distributor_id
const curStore = Taro.getStorageSync('curStore')
const { is_open_store_status } = this.state
const id = APP_PLATFORM === 'standard' ? is_open_store_status ? curStore.store_id :curStore.distributor_id : item.distributor_id
const url = `/pages/item/espier-detail?id=${item.item_id}&dtid=${id}`
Taro.navigateTo({
url
@@ -737,10 +755,11 @@ export default class Detail extends Component {
handleCouponClick = () => {
// const { distributor_id } = Taro.getStorageSync('curStore')
const { is_open_store_status } = this.state
let id = ''
if (APP_PLATFORM === 'standard') {
const { distributor_id } = Taro.getStorageSync('curStore')
id = distributor_id
const { distributor_id,store_id } = Taro.getStorageSync('curStore')
id = is_open_store_status ? store_id : distributor_id
} else {
const { info } = this.state
const { distributor_id } = info

View File

@@ -97,7 +97,7 @@ export default class List extends Component {
async fetch(params) {
const { page_no: page, page_size: pageSize } = params
const { selectParams, tagsList, curTagId } = this.state
const { distributor_id } = Taro.getStorageSync('curStore')
const { distributor_id,isNostores,store_id } = Taro.getStorageSync('curStore')
const query = {
...this.state.query,
@@ -108,7 +108,7 @@ export default class List extends Component {
}
if (APP_PLATFORM === 'standard') {
query.distributor_id = distributor_id
query.distributor_id = isNostores === 1 ? store_id : distributor_id
}
const { list, total_count: total, item_params_list = [], select_tags_list = [] } = await api.item.search(query)

View File

@@ -21,20 +21,33 @@ export default class StoreListItem extends Component {
}
render () {
const { info, onClick } = this.props
const { info, onClick,isStore } = this.props
if (!info) return null
const distance = info.distance ? (info.distance*1).toFixed(2) : false
return (
<View
className='store-item'
onClick={onClick}
>
<View className='store-content'>
<View className="store-name">{info.name}</View>
<View className="store-address">{info.store_address}</View>
<View className="store-content_left">
<View className="store-name">{info.name}</View>
<View className="store-address">{info.store_address}</View>
<View className="store-address">营业时间{info.hour}</View>
<View className="store-address">营业时间{info.mobile}</View>
</View>
{
distance && (
<View className="store-content_distance">
{distance}{info.distance_unit}
</View>
)
}
</View>
{
info.lat &&
!isStore && info.lat &&
<View
className='store-location icon-location'
onClick={this.handleMap.bind(this, info.lat, info.lng)}

View File

@@ -9,6 +9,16 @@
.store-content {
padding-right: 20px;
flex: 1;
border-right: 1PX solid #DDDDDD;
display: flex;
&_left{
flex:1
}
&_distance{
flex-basis: 100px;
color: #222222;
font-size: 20px;
}
.store-name {
font-size: 32px;
}

View File

@@ -53,9 +53,7 @@ export default class StoreList extends Component {
page,
pageSize
}
const { list, total_count: total} = await api.shop.list(query)
this.setState({
list: [...this.state.list, ...list],
query
@@ -145,6 +143,9 @@ export default class StoreList extends Component {
}
handleClick = (val) => {
if(val){
val.store_id = 0 //新增非门店自提开启distributor_id 取值为store_id
}
Taro.setStorageSync('curStore', val)
Taro.navigateBack()
}

View File

@@ -0,0 +1,482 @@
import Taro, { Component } from '@tarojs/taro'
import { View, ScrollView, Text,Picker } from '@tarojs/components'
import { SpToast, SearchBar, BackToTop, NavBar,SpCheckbox,SpNote } from '@/components'
import api from '@/api'
import { withPager, withBackToTop } from '@/hocs'
import entry from '@/utils/entry'
import StoreListItem from './comps/list-item'
import { pickBy } from '@/utils'
import { connect} from '@tarojs/redux'
import './ziti-list.scss'
import { de } from 'date-fns/locale'
@connect(({ cart }) => ({
curZitiShop: cart.zitiShop
}), (dispatch) => ({
onChangeZitiStore: (zitiShop) => dispatch({ type: 'cart/changeZitiStore', payload: zitiShop })
}))
@withPager
@withBackToTop
export default class StoreZitiList extends Component {
constructor (props) {
super(props)
this.state = {
...this.state,
list: [],
query: null,
current: null,
loading: false,
is_open_store_status:false,
multiIndex:[],
areaList: [],
info: {},
}
}
config = {
navigationBarTitleText: '选择自提门店'
}
componentDidMount () {
const lnglat = Taro.getStorageSync('lnglat')
const cityInfo = Taro.getStorageSync('selectShop')
let query = {}
// if (lnglat) {
// query = {
// lat: lnglat.latitude,
// lng: lnglat.longitude
// }
// }
if(cityInfo){
query = {
lat: lnglat.latitude,
lng: lnglat.longitude,
province:cityInfo.province,
city:cityInfo.city,
area:cityInfo.area,
}
}
const store = Taro.getStorageSync('curStore')
if (store) {
this.setState({
query,
current:cityInfo ? cityInfo : store
}, () => {
this.nextPage()
})
}else{
this.handleGetLocation()
}
}
async fetch (params) {
const isOpenStore = await entry.getStoreStatus()
const { page_no: page, page_size: pageSize } = params
const { shop_id,order_type, cart_type,seckill_id,ticket} = this.$router.params
const query = {
...this.state.query,
page,
pageSize,
cart_type,
order_type,
seckill_id,
seckill_ticket:ticket,
isNostores:isOpenStore ? 1 : 0,
}
const { list, total_count: total} = await api.shop.list(query)
const nList = pickBy(list, {
name: 'name',
store_address: 'store_address',
hour: 'hour',
mobile: 'mobile',
distributor_id: 'distributor_id',
regions:'regions',
regions_id:'regions_id',
is_checked:'is_checked',
lat:'lat',
lng:'lng',
distributor_self:'distributor_self',
distance:'distance',
distance_show:'distance_show',
distance_unit:'distance_unit',
store_id:isOpenStore ? '' : 0,
})
let res = await api.member.areaList()
const nAreaList = pickBy(res, {
label: 'label',
children: 'children',
})
this.nAreaList = nAreaList
let arrProvice = []
let arrCity = []
let arrCounty = []
nAreaList.map((item, index) => {
arrProvice.push(item.label)
if(index === 0) {
item.children.map((c_item, c_index) => {
arrCity.push(c_item.label)
if(c_index === 0) {
c_item.children.map(cny_item => {
arrCounty.push(cny_item.label)
})
}
})
}
})
this.setState({
list: [...this.state.list, ...nList],
query,
is_open_store_status:isOpenStore,
areaList: [arrProvice, arrCity, arrCounty],
})
return {
total
}
}
handleSearchOn = () => {
this.setState({
isShowSearch: true
})
}
handleSearchOff = () => {
this.setState({
isShowSearch: false
})
}
handleSearchChange = (val) => {
this.setState({
query: {
...this.state.query,
name: val
}
})
}
handleSearchClear = () => {
this.setState({
isShowSearch: false,
query: {
...this.state.query,
name: ''
}
}, () =>{
this.resetPage()
this.setState({
list: []
}, () => {
this.nextPage()
})
})
}
handleConfirm = (val) => {
this.setState({
query: {
...this.state.query,
name: val,
}
}, () =>{
this.resetPage()
this.setState({
list: []
}, () => {
this.nextPage()
})
})
}
handleGetLocation = async () => {
this.setState({
loading: true
})
Taro.removeStorageSync('lnglat')
const store = await entry.getLocal(true)
if (store) {
this.resetPage()
this.setState({
list: [],
current: store,
loading: false
}, () => {
this.nextPage()
})
} else {
this.setState({
current: null,
loading: false
})
}
}
handleSelectStore = (item) =>{
const { list } = this.state
list.map(v =>{
v.is_checked = false,
v.distributor_id == item.distributor_id && (v.is_checked = true)
return {
...v,
is_checked:v.is_checked
}
})
this.setState({
list
})
}
// handleClick = (val) => {
// Taro.setStorageSync('curStore', val)
// Taro.navigateBack()
// }
// 选定开户地区
handleClickPicker = () => {
console.log('handleClickPicker')
let arrProvice = []
let arrCity = []
let arrCounty = []
if(this.nAreaList){
this.nAreaList.map((item, index) => {
arrProvice.push(item.label)
if(index === 0) {
item.children.map((c_item, c_index) => {
arrCity.push(c_item.label)
if(c_index === 0) {
c_item.children.map(cny_item => {
arrCounty.push(cny_item.label)
})
}
})
}
})
this.setState({
showDrawer: false,
areaList: [arrProvice, arrCity, arrCounty],
multiIndex: [0, 0, 0]
})
}
}
bindMultiPickerChange = async (e) => {
const { info,query } = this.state
this.nAreaList.map((item, index) => {
if(index === e.detail.value[0]) {
info.province = item.label
item.children.map((s_item,sIndex) => {
if(sIndex === e.detail.value[1]) {
info.city = s_item.label
s_item.children.map((th_item,thIndex) => {
if(thIndex === e.detail.value[2]) {
info.county = th_item.label
}
})
}
})
}
})
const { province, city,county } = info
// delete query.lat
// delete query.lng
this.setState({
query: {
...this.state.query,
province,
city,
area:county,
}
}, () => {
this.resetPage()
this.setState({
list: []
}, () => {
this.nextPage()
})
})
this.setState({ info })
}
bindMultiPickerColumnChange = (e) => {
const { areaList, multiIndex } = this.state
if(e.detail.column === 0) {
this.setState({
multiIndex: [e.detail.value,0,0]
})
this.nAreaList.map((item, index) => {
if(index === e.detail.value) {
let arrCity = []
let arrCounty = []
item.children.map((c_item, c_index) => {
arrCity.push(c_item.label)
if(c_index === 0) {
c_item.children.map(cny_item => {
arrCounty.push(cny_item.label)
})
}
})
areaList[1] = arrCity
areaList[2] = arrCounty
this.setState({ areaList })
}
})
} else if (e.detail.column === 1) {
multiIndex[1] = e.detail.value
multiIndex[2] = 0
this.setState({
multiIndex
},()=>{
this.nAreaList[multiIndex[0]].children.map((c_item, c_index) => {
if(c_index === e.detail.value) {
let arrCounty = []
c_item.children.map(cny_item => {
arrCounty.push(cny_item.label)
})
areaList[2] = arrCounty
this.setState({ areaList })
}
})
})
} else {
multiIndex[2] = e.detail.value
this.setState({
multiIndex
})
}
}
handleChangeStore = ()=>{
let { list,info } = this.state
if(!list.length) return
const selected = list.filter(v=>v.is_checked)
if(!selected.length){
Taro.showToast({
title: '请选择店铺~',
icon: 'none'
})
return
}
this.props.onChangeZitiStore(selected[0])
Taro.setStorageSync('selectShop',selected[0])
setTimeout(() => {
Taro.navigateBack()
}, 300)
}
render () {
const { list, scrollTop, showBackToTop, loading, current, query,is_open_store_status,areaList,multiIndex,page,info } = this.state
return (
<View className='page-store-list'>
<NavBar
title='选择自提门店'
leftIconType='chevron-left'
/>
{/* <View className='store-list__search'>
<SearchBar
showDailog={false}
keyword={query ? query.name : ''}
onFocus={this.handleSearchOn}
onChange={this.handleSearchChange}
onClear={this.handleSearchClear}
onCancel={this.handleSearchOff}
onConfirm={this.handleConfirm.bind(this)}
/>
</View> */}
<Picker
mode='multiSelector'
onClick={this.handleClickPicker}
onChange={this.bindMultiPickerChange}
onColumnChange={this.bindMultiPickerColumnChange}
value={multiIndex}
range={areaList}
>
<View className='current-store'>
{/* <View className='label'>当前位置</View> */}
<View className='content view-flex'>
<View className='view-flex-item'>
{
loading
? <Text className='loading'>定位中...</Text>
: <Text>
<Text className='icon-periscope'></Text>
{
info && info.province
? <Text>{info.province}{info.city}{info.county}</Text>
: current
? <Text> {current.regions[0]}{current.regions[1]}{current.regions[2]} </Text>
:'定位失败'
}
</Text>
}
</View>
<View
className='view-flex view-flex-middle'
><Text className='icon-arrowRight' />
</View>
</View>
</View>
</Picker>
<ScrollView
className='page-store-list__scroll'
scrollY
scrollTop={scrollTop}
scrollWithAnimation
onScroll={this.handleScroll}
onScrollToLower={this.nextPage}
>
<View className='store-list'>
{
list.map(item => {
return (
<View className="store-item" key={item.distributor_id}>
<View className="store-content">
<StoreListItem
info={item}
isStore={is_open_store_status}
key={item.distributor_id}
//onClick={this.handleClick.bind(this, item)}
/>
</View>
<View>
<SpCheckbox
checked={item.is_checked}
onChange={this.handleSelectStore.bind(this,item)}
>
</SpCheckbox>
</View>
</View>
)
})
}
{
list.length && (
<View className="store-list_footer">
<View className='sure-button' onClick={this.handleChangeStore.bind(this)}>确定</View>
</View>
)
}
</View>
{ page.isLoading ? <Loading>正在加载...</Loading> : null }
{
!page.isLoading && !page.hasNext && !list.length
&& (<SpNote img='trades_empty.png'>暂无数据~</SpNote>)
}
</ScrollView>
<BackToTop
show={showBackToTop}
onClick={this.scrollBackToTop}
/>
<SpToast />
</View>
)
}
}

View File

@@ -0,0 +1,113 @@
@import "../../style/imports";
@import "../../style/animations";
$current-shop-height: 150px !default;
.page-store-list {
height: 100%;
box-sizing: border-box;
/* #ifdef h5 */
padding-top: $navigate-height-h5;
/* #endif */
&__scroll {
@include page-scroll(100px);
/* #ifdef h5 */
@include page-scroll($current-shop-height + $navigate-height-h5 + 10);
/* #endif */
padding-bottom: 130px;
}
.store-list__search {
.at-search-bar {
padding-right: 30px !important;
}
.search-input {
box-shadow: none;
&__focus{
.at-search-bar {
padding-right: 30px !important;
}
}
}
.at-search-bar__input {
height: $searchbar-height !important;
}
.at-search-bar__input-cnt {
flex: none;
border-radius: $searchbar-height;
}
.at-search-bar__clear {
height: $searchbar-height;
}
.at-search-bar__action {
display: none;
}
}
.store-list {
.store-item {
display: flex;
align-items: center;
margin-bottom: 20px;
padding: 20px;
background: #fff;
.store-content {
padding-right: 20px;
flex: 1;
.store-name {
font-size: 32px;
}
.store-address {
font-size: $font-size-small;
color: $color-gray;
}
}
.store-location {
font-size: 46px;
color: $color-gray;
}
}
&_footer{
position: fixed;
width: 100%;
bottom: 0;
left:0;
height: 120px;
padding-left: 15px;
padding-right: 15px;
padding-top: 10px;
background: #fff;
.sure-button{
height: 100px;
line-height: 100px;
background: #D0021B;
border-radius: 50px;
width: 100%;
text-align: center;
color: #fff;
font-size: 28px;
}
}
}
.current-store {
padding-top: 10px;
// height: $current-shop-height;
.label {
padding: 0 30px;
height: 50px;
line-height: 50px;
background: #f8f8f8;
}
.content {
padding: 0 30px;
height: 80px;
line-height: 80px;
.loading {
@include fade-loop(1s);
}
[class^="icon-"] {
font-size: 42px;
color: $color-gray;
}
}
}
}

View File

@@ -105,6 +105,15 @@ const cart = createReducer(initState, {
coupon
}
},
['cart/changeZitiStore'](state,action){
const zitiShop = action.payload
return {
...state,
zitiShop
}
},
['cart/changeDrugInfo'](state, action) {
const drugInfo = action.payload

View File

@@ -13,12 +13,13 @@ async function entryLaunch(data, isNeedLocate) {
} else {
options = data
}
console.log('options---->',options)
// 如果没有带店铺id
if (!options.dtid) {
let { distributor_id } = Taro.getStorageSync('curStore')
let { distributor_id,isNostores,store_id } = Taro.getStorageSync('curStore')
if (distributor_id) {
options.dtid = distributor_id
options.dtid =isNostores === 1 ? "" : distributor_id
}
}
let dtidValid = false
@@ -80,9 +81,14 @@ async function getLocalSetting() {
}
}
// store = {
// distributor_id:0
// }
// Taro.setStorageSync('curStore', store)
async function getLocal (isNeedLocate) {
const positionStatus = await getLocalSetting()
let store = null
const positionStatus = await getLocalSetting()
if (!positionStatus) {
store = await api.shop.getShop()
} else {
@@ -108,12 +114,15 @@ async function getLocal (isNeedLocate) {
}
}
}
if (!store.status) {
// 新增逻辑,如果开启了非门店自提流程,新增字段,开启非门店自提流程所有的distribution_id 取值为0store_id
store.store_id = 0
Taro.setStorageSync('curStore', store)
} else {
Taro.setStorageSync('curStore', [])
}
if (!store.status) {
Taro.setStorageSync('curStore', store)
} else {
Taro.setStorageSync('curStore', [])
}
return store
}
@@ -134,6 +143,15 @@ async function getLoc () {
}
}
async function getStoreStatus(){
const {nostores_status} = await api.shop.getStoreStatus()
if(nostores_status === 'true'){
return true
} else {
return false
}
}
// web定位获取
function getWebLocal (isSetStorage = true) {
const { qq } = window
@@ -162,8 +180,6 @@ function getWebLocal (isSetStorage = true) {
})
})
}
// 新增千人千码跟踪记录
function trackViewNum (monitor_id, source_id) {
let _session = Taro.getStorageSync('_session')
@@ -181,7 +197,10 @@ function trackViewNum (monitor_id, source_id) {
// distributorId 店铺ID
async function handleDistributorId(distributorId) {
const res = await api.shop.getShop({distributor_id: distributorId})
//const isOpenStore = await getStoreStatus()
if (res.status === false) {
// 新增逻辑,如果开启了非门店自提流程,新增字段,开启非门店自提流程所有的distribution_id 取值为0store_id
res.store_id = 0
Taro.setStorageSync('curStore', res)
} else {
Taro.setStorageSync('curStore', [])
@@ -219,5 +238,6 @@ export default {
getLocal,
getLocalSetting,
getWebLocal,
InverseAnalysis
InverseAnalysis,
getStoreStatus
}