From b3745b588ab7f162a044e73d4562b0bca8bff6eb Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Mon, 23 Nov 2020 18:37:44 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- config/host.js | 6 +++--- project.config.json | 2 +- src/app.js | 8 ++++---- src/ext.json | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.env b/.env index 0c519305a..2981ff3b6 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -APP_BASE_URL=https://ecshopx1.shopex123.com/api/h5app/wxapp +APP_BASE_URL=https://ecshopx2.shopex123.com/api/h5app/wxapp APP_WEBSOCKET=wss://ecshopx.shopex123.com/ws APP_COMPANY_ID=1 APP_PLATFORM=standard diff --git a/config/host.js b/config/host.js index eadb18876..fc4f71ed7 100644 --- a/config/host.js +++ b/config/host.js @@ -5,9 +5,9 @@ module.exports = { test: 'ecshopx.shopex123.com/index.php' }, weapp: { - prod: 'ecshopx.shopex123.com/index.php', - preissue: 'ecshopx.shopex123.com/index.php', - test: 'ecshopx.shopex123.com/index.php' + prod: 'ecshopx2.shopex123.com', + preissue: 'ecshopx2.shopex123.com', + test: 'ecshopx2.shopex123.com' }, websocket: { development: 'wss://ecshopx.shopex123.com/ws', diff --git a/project.config.json b/project.config.json index 30e37f8f8..24e52099b 100644 --- a/project.config.json +++ b/project.config.json @@ -2,7 +2,7 @@ "miniprogramRoot": "dist/", "projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E%E5%B9%B3%E5%8F%B0%E7%89%88", "description": "weshop for platform", - "appid": "wx3e1c17c88abf3e45", + "appid": "wx32b438e5538d90ed", "setting": { "urlCheck": false, "scopeDataCheck": false, diff --git a/src/app.js b/src/app.js index c035aad54..d139ee733 100644 --- a/src/app.js +++ b/src/app.js @@ -161,10 +161,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" diff --git a/src/ext.json b/src/ext.json index fcd22427e..1877d7e6a 100644 --- a/src/ext.json +++ b/src/ext.json @@ -1,9 +1,9 @@ { "extEnable": true, - "extAppid": "wx3e1c17c88abf3e45", + "extAppid": "wx32b438e5538d90ed", "ext": { "company_id": "1", - "appid": "wx3e1c17c88abf3e45", + "appid": "wx32b438e5538d90ed", "wxa_name": "通用小程序" }, "window": { From 7b1c54d32acebcdd2970a7a9ac1aa80301547bf7 Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Tue, 24 Nov 2020 11:53:16 +0800 Subject: [PATCH 02/21] =?UTF-8?q?=E9=9D=9E=E9=97=A8=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/shop.js | 4 ++ src/pages/cart/espier-index.js | 7 +++ src/pages/home/wgts/header-home.js | 19 ++++---- src/pages/index.js | 41 ++++++++++++----- src/pages/item/espier-detail.js | 72 +++++++++++++++++------------- src/utils/entry.js | 24 ++++++++-- 6 files changed, 111 insertions(+), 56 deletions(-) diff --git a/src/api/shop.js b/src/api/shop.js index 4c34bcdd2..a2b820a73 100644 --- a/src/api/shop.js +++ b/src/api/shop.js @@ -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) +} \ No newline at end of file diff --git a/src/pages/cart/espier-index.js b/src/pages/cart/espier-index.js index 9fef3dd36..2e9a0d8f8 100644 --- a/src/pages/cart/espier-index.js +++ b/src/pages/cart/espier-index.js @@ -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,9 +217,15 @@ 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 } + if(isOpenStore){ + params.isNostores = 1 + }else{ + params.isNostores = 0 + } if (cartTypeLocal === 'cross') { params.iscrossborder = 1 } else { diff --git a/src/pages/home/wgts/header-home.js b/src/pages/home/wgts/header-home.js index eeff15369..d2958aaaf 100644 --- a/src/pages/home/wgts/header-home.js +++ b/src/pages/home/wgts/header-home.js @@ -56,14 +56,18 @@ export default class HeaderHome extends Component { return ( - { - store.name && + - - - {store.name || '选择店铺'} - - + { + store.name && ( + + + {store.name || '选择店铺'} + + + ) + } + { Taro.getEnv() !== 'WEB' && isOpenScanQrcode==1 && @@ -71,7 +75,6 @@ export default class HeaderHome extends Component { } - } ) } diff --git a/src/pages/index.js b/src/pages/index.js index 7781039e9..bfdf85edf 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -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, // 是否有跳转至店铺页 @@ -77,6 +78,7 @@ export default class HomeIndex extends Component { // // const res = parseUrlStr(queryStr) // } this.checkWhite() + //this.fetchStoreStatus() api.wx.shareSetting({shareindex: 'index'}).then(res => { this.setState({ shareInfo: res @@ -87,26 +89,41 @@ export default class HomeIndex extends Component { async fetchSetInfo() { const setUrl = '/pagestemplate/setInfo' const {is_open_recommend, is_open_scan_qrcode, is_open_wechatapp_location,is_open_official_account} = await req.get(setUrl) + const isOpenStore = await entry.getStoreStatus() + let store = {} this.setState({ 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, + is_open_store_status:isOpenStore }, 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() - }) + if(this.state.is_open_store_status){ + store.distributor_id = 0 + if (!isArray(store)) { + this.setState({ + curStore: store + }, () => { + this.fetchData() + }) + } + + }else { + 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' diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index 41f9c8def..c6f80cdcb 100644 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -67,7 +67,8 @@ export default class Detail extends Component { evaluationList: [], evaluationTotal: 0, // 是否订阅 - isSubscribeGoods: false + isSubscribeGoods: false, + is_open_store_status:null, } } @@ -75,39 +76,46 @@ 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 entryData = await entry.entryLaunch(options, true) - id = entryData.id - uid = entryData.uid - } - if (uid) { - this.uid = uid - } - if(!S.getAuthToken()){ - setTimeout(() => { - this.checkWhite() - }, 1000) - } - this.fetchInfo(id) - this.getEvaluationList(id) - // 浏览记录 - if (S.getAuthToken()) { - try { - let itemId = '' - if (id) { - itemId = id - } else { - itemId = this.$router.params.id + const isOpenStore = await entry.getStoreStatus() + this.setState({ + is_open_store_status:isOpenStore + },async()=>{ + const { is_open_store_status }= this.state + if (APP_PLATFORM === 'standard') { + const { distributor_id } = Taro.getStorageSync('curStore') + if (!options.dtid || options.dtid !== 0) { + options.dtid = is_open_store_status ? '0' : distributor_id } - api.member.itemHistorySave(itemId) - } catch (e) { - console.log(e) + const entryData = await entry.entryLaunch(options, true) + id = entryData.id + uid = entryData.uid } - } + if (uid) { + this.uid = uid + } + if(!S.getAuthToken()){ + setTimeout(() => { + this.checkWhite() + }, 1000) + } + this.fetchInfo(id) + this.getEvaluationList(id) + // 浏览记录 + if (S.getAuthToken()) { + try { + let itemId = '' + if (id) { + itemId = id + } else { + itemId = this.$router.params.id + } + api.member.itemHistorySave(itemId) + } catch (e) { + console.log(e) + } + } + }) + // 处理定位 const lnglat = Taro.getStorageSync('lnglat') diff --git a/src/utils/entry.js b/src/utils/entry.js index 15d3cb43a..8ba592573 100644 --- a/src/utils/entry.js +++ b/src/utils/entry.js @@ -81,8 +81,15 @@ async function getLocalSetting() { } async function getLocal (isNeedLocate) { - const positionStatus = await getLocalSetting() + const isOpenStore = await getStoreStatus() let store = null + if(isOpenStore){ + store = { + distributor_id:0 + } + Taro.setStorageSync('curStore', store) + }else { + const positionStatus = await getLocalSetting() if (!positionStatus) { store = await api.shop.getShop() } else { @@ -114,6 +121,7 @@ async function getLocal (isNeedLocate) { } else { Taro.setStorageSync('curStore', []) } +} return store } @@ -134,6 +142,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 +179,6 @@ function getWebLocal (isSetStorage = true) { }) }) } - - // 新增千人千码跟踪记录 function trackViewNum (monitor_id, source_id) { let _session = Taro.getStorageSync('_session') @@ -219,5 +234,6 @@ export default { getLocal, getLocalSetting, getWebLocal, - InverseAnalysis + InverseAnalysis, + getStoreStatus } From b4c771e139d327707a2aa2ea80e8e59987bc88d1 Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Tue, 24 Nov 2020 15:44:22 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E9=9D=9E=E8=87=AA=E6=8F=90=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.js | 1 + src/pages/cart/espier-checkout.js | 42 +++- src/pages/cart/espier-checkout.scss | 3 + src/pages/store/comps/list-item.js | 21 +- src/pages/store/comps/list-item.scss | 10 + src/pages/store/ziti-list.js | 279 +++++++++++++++++++++++++++ src/pages/store/ziti-list.scss | 92 +++++++++ src/utils/entry.js | 28 +-- 8 files changed, 454 insertions(+), 22 deletions(-) create mode 100644 src/pages/store/ziti-list.js create mode 100644 src/pages/store/ziti-list.scss diff --git a/src/app.js b/src/app.js index d139ee733..517416c80 100644 --- a/src/app.js +++ b/src/app.js @@ -110,6 +110,7 @@ class App extends Component { 'pages/store/index', 'pages/store/list', + 'pages/store/ziti-list', 'pages/custom/custom-page' ], diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 0af3f9515..08c3f73e1 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -33,6 +33,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, { @@ -123,7 +124,8 @@ export default class CartCheckout extends Component { //积分相关 isPointOpen: false, point_use: 0, - pointInfo: null + pointInfo: null, + isOpenStore:null }; } @@ -257,18 +259,29 @@ export default class CartCheckout extends Component { async fetchZiTiShop() { const { shop_id, scene } = this.$router.params; + const isOpenStore = await entry.getStoreStatus() + // const {curStore} = this.state // const shopInfo = await api.shop.getShop({distributor_id: shop_id}) let id = shop_id; + let params ={} if (scene) { const { dtid } = normalizeQuerys(this.$router.params); id = dtid; } - const shopInfo = await api.shop.getShop({ distributor_id: id }); + if(isOpenStore){ + let lnglat = Taro.getStorageSync('lnglat') + params.lat = lnglat.latitude + params.lng = lnglat.longitude + }else{ + params.distributor_id = id + } + const shopInfo = await api.shop.getShop(params); this.setState({ curStore: shopInfo, receiptType: shopInfo.is_delivery ? "logistics" : "ziti", - express: shopInfo.is_delivery ? true : false + express: shopInfo.is_delivery ? true : false, + isOpenStore }); } @@ -736,6 +749,12 @@ export default class CartCheckout extends Component { scale: 18 }); }; + handleEditZitiClick =(id) =>{ + const { curStore } = this.state; + Taro.navigateTo({ + url: `/pages/store/ziti-list?shop_id=${id}` + }) + } handleShippingChange = type => { console.log(type); @@ -1369,7 +1388,8 @@ export default class CartCheckout extends Component { pointInfo, isPointOpen, identity, - quota_tip + quota_tip, + isOpenStore } = this.state; // let curStore = {} // if (shopData) { @@ -1393,6 +1413,7 @@ export default class CartCheckout extends Component { : (coupon.value && coupon.value.title) || ""; //const isBtnDisabled = !address const isBtnDisabled = express ? !address : false; + console.log('curStore---->',curStore) return ( @@ -1446,10 +1467,17 @@ export default class CartCheckout extends Component { {curStore.name} {curStore.store_address} - + : + } diff --git a/src/pages/cart/espier-checkout.scss b/src/pages/cart/espier-checkout.scss index 48b46ca65..99a31b919 100644 --- a/src/pages/cart/espier-checkout.scss +++ b/src/pages/cart/espier-checkout.scss @@ -98,6 +98,9 @@ color: #666; } } + .icon-edit{ + color: #D0021B !important; + } } .sec-checkout-items { diff --git a/src/pages/store/comps/list-item.js b/src/pages/store/comps/list-item.js index 6a677789d..b8f6e7e1a 100644 --- a/src/pages/store/comps/list-item.js +++ b/src/pages/store/comps/list-item.js @@ -21,7 +21,7 @@ export default class StoreListItem extends Component { } render () { - const { info, onClick } = this.props + const { info, onClick,isStore } = this.props if (!info) return null return ( @@ -30,11 +30,24 @@ export default class StoreListItem extends Component { onClick={onClick} > - {info.name} - {info.store_address} + + {info.name} + {info.store_address} + 营业时间:{info.hour} + 营业时间:{info.mobile} + + + { + info.distance && ( + + {info.distance}{info.distance_unit} + + ) + } + { - info.lat && + !isStore && info.lat && { + this.nextPage() + }) + } + + } + + async fetch (params) { + const isOpenStore = await entry.getStoreStatus() + const { page_no: page, page_size: pageSize } = params + const { selectParams, areaList, tagsList, curTagId } = this.state + const query = { + ...this.state.query, + page, + pageSize + } + + 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', + lat:'lat', + lng:'lng', + distributor_self:'distributor_self', + distance:({ distance }) => (distance*1).toFixed(2), + distance_show:({ distance_show }) => (distance_show*1).toFixed(2), + distance_unit:'distance_unit', + is_checked:'is_checked' + }) + this.setState({ + list: [...this.state.list, ...nList], + query, + is_open_store_status:isOpenStore + }) + + 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) + console.log('store---->',store) + if (store) { + Taro.setStorageSync('curStore', 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 + console.log('list--->',list) + 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() + } + + render () { + const { list, scrollTop, showBackToTop, loading, current, query,is_open_store_status } = this.state + let {shop_id} = this.$router.params + return ( + + + + + + + {/* 当前位置 */} + + + { + loading + ? 定位中... + : {current ? current.name : '定位失败...'} + } + + {/* 重新定位 + */} + 上海市徐汇区 + + + + + + { + list.map(item => { + return ( + + + + + + + + + + + + ) + }) + } + + + + + + + + ) + } +} diff --git a/src/pages/store/ziti-list.scss b/src/pages/store/ziti-list.scss new file mode 100644 index 000000000..a506e21c5 --- /dev/null +++ b/src/pages/store/ziti-list.scss @@ -0,0 +1,92 @@ +@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($searchbar-height + $current-shop-height + $navigate-height + 10); + /* #ifdef h5 */ + @include page-scroll($searchbar-height + $current-shop-height + $navigate-height-h5 + 10); + /* #endif */ + } + .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; + } + } + } + .current-store { + background: #fff; + 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; + } + } + } +} diff --git a/src/utils/entry.js b/src/utils/entry.js index 8ba592573..2e4d1e1ec 100644 --- a/src/utils/entry.js +++ b/src/utils/entry.js @@ -80,15 +80,14 @@ async function getLocalSetting() { } } + + // store = { + // distributor_id:0 + // } + // Taro.setStorageSync('curStore', store) async function getLocal (isNeedLocate) { const isOpenStore = await getStoreStatus() let store = null - if(isOpenStore){ - store = { - distributor_id:0 - } - Taro.setStorageSync('curStore', store) - }else { const positionStatus = await getLocalSetting() if (!positionStatus) { store = await api.shop.getShop() @@ -115,13 +114,20 @@ async function getLocal (isNeedLocate) { } } } - - if (!store.status) { + if(isOpenStore){ + store = { + distributor_id:0 + } Taro.setStorageSync('curStore', store) - } else { - Taro.setStorageSync('curStore', []) + }else{ + if (!store.status) { + Taro.setStorageSync('curStore', store) + } else { + Taro.setStorageSync('curStore', []) + } } -} + + return store } From c4945d155146aedaadff708abaaf3dc965979850 Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Tue, 24 Nov 2020 16:20:28 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E9=9D=9E=E8=87=AA=E6=8F=90=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/espier-checkout.js | 7 ++++--- src/pages/item/espier-detail.js | 5 ++++- src/pages/store/ziti-list.js | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 08c3f73e1..7579fc2f5 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -258,7 +258,7 @@ export default class CartCheckout extends Component { } async fetchZiTiShop() { - const { shop_id, scene } = this.$router.params; + const { shop_id, scene,cart_type} = this.$router.params; const isOpenStore = await entry.getStoreStatus() // const {curStore} = this.state @@ -273,6 +273,7 @@ export default class CartCheckout extends Component { let lnglat = Taro.getStorageSync('lnglat') params.lat = lnglat.latitude params.lng = lnglat.longitude + params.cart_type = cart_type }else{ params.distributor_id = id } @@ -750,9 +751,9 @@ export default class CartCheckout extends Component { }); }; handleEditZitiClick =(id) =>{ - const { curStore } = this.state; + const {cart_type} = this.$router.params; Taro.navigateTo({ - url: `/pages/store/ziti-list?shop_id=${id}` + url: `/pages/store/ziti-list?shop_id=${id}&cart_type=${cart_type}` }) } diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index c6f80cdcb..48dfdccfd 100644 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -84,8 +84,11 @@ export default class Detail extends Component { if (APP_PLATFORM === 'standard') { const { distributor_id } = Taro.getStorageSync('curStore') if (!options.dtid || options.dtid !== 0) { - options.dtid = is_open_store_status ? '0' : distributor_id + options.dtid = is_open_store_status ? '' : distributor_id } + // if(is_open_store_status){ + // delete options.dtid + // } const entryData = await entry.entryLaunch(options, true) id = entryData.id uid = entryData.uid diff --git a/src/pages/store/ziti-list.js b/src/pages/store/ziti-list.js index b897928c9..8496112d7 100644 --- a/src/pages/store/ziti-list.js +++ b/src/pages/store/ziti-list.js @@ -54,10 +54,12 @@ export default class StoreZitiList extends Component { const isOpenStore = await entry.getStoreStatus() const { page_no: page, page_size: pageSize } = params const { selectParams, areaList, tagsList, curTagId } = this.state + const { cart_type} = this.$router.params const query = { ...this.state.query, page, - pageSize + pageSize, + cart_type } const { list, total_count: total} = await api.shop.list(query) From 187535b13e98fed1ddde9ea253699b7c06ceb67b Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Tue, 24 Nov 2020 20:27:43 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E9=9D=9E=E9=97=A8=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E6=B5=81=E7=A8=8B=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/espier-checkout.js | 56 ++++++++++----- src/pages/store/ziti-list.js | 115 +++++++++++++++++++++++------- src/pages/store/ziti-list.scss | 27 ++++++- src/store/cart.js | 9 +++ 4 files changed, 163 insertions(+), 44 deletions(-) diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 7579fc2f5..965db1794 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -58,7 +58,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" }), @@ -68,7 +69,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 }) }) ) @@ -222,6 +225,7 @@ export default class CartCheckout extends Component { }); // this.handleAddressChange(this.props.defaultAddress) this.props.onAddressChoose(null); + this.props.onChangeZitiStore(null); this.getSalespersonNologin(); // this.getShop() this.fetchAddress(); @@ -232,6 +236,9 @@ export default class CartCheckout extends Component { if (nextProps.address !== this.props.address) { this.fetchAddress(); } + if(nextProps.zitiShop !== this.props.zitiShop){ + this.fetchZiTiShop(); + } } componentWillUnmount() { @@ -260,29 +267,47 @@ export default class CartCheckout extends Component { async fetchZiTiShop() { const { shop_id, scene,cart_type} = this.$router.params; const isOpenStore = await entry.getStoreStatus() - + const { zitiShop } = this.props; // const {curStore} = this.state // const shopInfo = await api.shop.getShop({distributor_id: shop_id}) let id = shop_id; - let params ={} + let ztparams ={} if (scene) { const { dtid } = normalizeQuerys(this.$router.params); id = dtid; } - if(isOpenStore){ - let lnglat = Taro.getStorageSync('lnglat') - params.lat = lnglat.latitude - params.lng = lnglat.longitude - params.cart_type = cart_type + if(zitiShop){ + if(isOpenStore){ + ztparams.lat = zitiShop.lat + ztparams.lng = zitiShop.lng + ztparams.cart_type = cart_type + ztparams.isNostores = 1 + }else{ + ztparams.distributor_id = zitiShop.distributor_id + ztparams.isNostores = 0 + } }else{ - params.distributor_id = id + if(isOpenStore){ + let lnglat = Taro.getStorageSync('lnglat') + ztparams.lat = lnglat.latitude + ztparams.lng = lnglat.longitude + ztparams.cart_type = cart_type + ztparams.isNostores = 1 + }else{ + ztparams.distributor_id = id + ztparams.isNostores = 0 + } } - const shopInfo = await api.shop.getShop(params); + console.log('params33---------->',ztparams) + const shopInfo = await api.shop.getShop(ztparams); + console.log('shopInfo------>',shopInfo) this.setState({ curStore: shopInfo, receiptType: shopInfo.is_delivery ? "logistics" : "ziti", express: shopInfo.is_delivery ? true : false, isOpenStore + },()=>{ + this.calcOrder() }); } @@ -510,7 +535,8 @@ export default class CartCheckout extends Component { }; } const { payType, receiptType, point_use } = this.state; - const { coupon, drugInfo } = this.props; + const { coupon, drugInfo,zitiShop } = this.props; + console.log('zitiShop----->',zitiShop) if (drugInfo) { this.setState({ drug: drugInfo @@ -529,8 +555,7 @@ 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), + distributor_id:zitiShop ? zitiShop.distributor_id : this.getShopId() || (shop_id === "undefined" ? 0 : shop_id), ...drugInfo, point_use: point_use }; @@ -1414,8 +1439,7 @@ export default class CartCheckout extends Component { : (coupon.value && coupon.value.title) || ""; //const isBtnDisabled = !address const isBtnDisabled = express ? !address : false; - console.log('curStore---->',curStore) - + console.log('curStorer44555--->',curStore) return ( {showAddressPicker === false ? ( diff --git a/src/pages/store/ziti-list.js b/src/pages/store/ziti-list.js index 8496112d7..5d0abd1af 100644 --- a/src/pages/store/ziti-list.js +++ b/src/pages/store/ziti-list.js @@ -1,14 +1,19 @@ import Taro, { Component } from '@tarojs/taro' -import { View, ScrollView, Text } from '@tarojs/components' -import { SpToast, SearchBar, BackToTop, NavBar,SpCheckbox } from '@/components' +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 './list.scss' - +import './ziti-list.scss' +@connect(({ cart }) => ({ + curZitiShop: cart.zitiShop +}), (dispatch) => ({ + onChangeZitiStore: (zitiShop) => dispatch({ type: 'cart/changeZitiStore', payload: zitiShop }) +})) @withPager @withBackToTop export default class StoreZitiList extends Component { @@ -21,7 +26,9 @@ export default class StoreZitiList extends Component { query: null, current: null, loading: false, - is_open_store_status:false + is_open_store_status:false, + multiIndex:[], + areaList: [], } } config = { @@ -47,6 +54,7 @@ export default class StoreZitiList extends Component { this.nextPage() }) } + //this.handleGetLocation() } @@ -79,10 +87,33 @@ export default class StoreZitiList extends Component { distance_unit:'distance_unit', is_checked:'is_checked' }) + 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 + is_open_store_status:isOpenStore, + areaList: [arrProvice, arrCity, arrCounty], }) return { @@ -149,10 +180,10 @@ export default class StoreZitiList extends Component { loading: true }) Taro.removeStorageSync('lnglat') - const store = await entry.getLocal(true) + const store = await entry.getLocal(true,'0') console.log('store---->',store) if (store) { - Taro.setStorageSync('curStore', store) + // Taro.setStorageSync('curStore', store) this.resetPage() this.setState({ list: [], @@ -170,7 +201,7 @@ export default class StoreZitiList extends Component { } handleSelectStore = (item) =>{ const { list } = this.state - console.log('list--->',list) + const{ shop_id } =this.$router.params list.map(v =>{ v.is_checked = false, v.distributor_id == item.distributor_id && (v.is_checked = true) @@ -185,21 +216,38 @@ export default class StoreZitiList extends Component { } - handleClick = (val) => { - Taro.setStorageSync('curStore', val) - Taro.navigateBack() + // handleClick = (val) => { + // Taro.setStorageSync('curStore', val) + // Taro.navigateBack() + // } + handleChangeStore = ()=>{ + let { list } = 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]) + setTimeout(() => { + Taro.navigateBack() + }, 300) + } render () { - const { list, scrollTop, showBackToTop, loading, current, query,is_open_store_status } = this.state - let {shop_id} = this.$router.params + const { list, scrollTop, showBackToTop, loading, current, query,is_open_store_status,areaList,multiIndex,page } = this.state + const { shop_id } = this.$router.params return ( - + {/* - - + */} + + {/* 当前位置 */} { loading ? 定位中... - : {current ? current.name : '定位失败...'} + : + { + current + ? {current.regions[0]}{current.regions[1]}{current.regions[2]} + :'定位失败' + } + } - {/* 重新定位 - */} 上海市徐汇区 + > + + 确定 + + { page.isLoading ? 正在加载... : null } + { + !page.isLoading && !page.hasNext && !list.length + && (暂无数据~) + } Date: Wed, 25 Nov 2020 11:57:25 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=E9=9D=9E=E9=97=A8=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E6=B5=81=E7=A8=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/cart.js | 3 +- src/components/goods-buy-panel/index.js | 6 +- src/pages/cart/espier-checkout.js | 4 +- src/pages/home/wgts/header-home.js | 2 +- src/pages/index.js | 33 ++++--- src/pages/item/espier-detail.js | 47 +++++---- src/pages/item/list.js | 4 +- src/pages/store/ziti-list.js | 125 +++++++++++++++++++++++- src/utils/entry.js | 18 ++-- 9 files changed, 188 insertions(+), 54 deletions(-) diff --git a/src/api/cart.js b/src/api/cart.js index 442592e54..18451aaea 100644 --- a/src/api/cart.js +++ b/src/api/cart.js @@ -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' } diff --git a/src/components/goods-buy-panel/index.js b/src/components/goods-buy-panel/index.js index de75c3890..511655b2d 100644 --- a/src/components/goods-buy-panel/index.js +++ b/src/components/goods-buy-panel/index.js @@ -279,6 +279,8 @@ export default class GoodsBuyPanel extends Component { const isDrug = special_type === "drug"; const { item_id } = this.noSpecs ? info : skuInfo; const { distributor_id } = info; + const curStore = Taro.getStorageSync('curStore'); + let id = curStore.isNostores == 1 ? curStore.store_id: distributor_id let url = `/pages/cart/espier-checkout`; this.setState({ @@ -323,7 +325,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 +350,7 @@ export default class GoodsBuyPanel extends Component { await api.cart.fastBuy({ item_id, num, - distributor_id + distributor_id:id }); } catch (e) { console.log(e); diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 965db1794..0265609b1 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -1021,8 +1021,8 @@ 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,isNostores,store_id } = Taro.getStorageSync("curStore"); + params.distributor_id = this.getShopId() || isNostores === 1 ? store_id :distributor_id; } delete params.items; diff --git a/src/pages/home/wgts/header-home.js b/src/pages/home/wgts/header-home.js index d2958aaaf..e6bf253bb 100644 --- a/src/pages/home/wgts/header-home.js +++ b/src/pages/home/wgts/header-home.js @@ -59,7 +59,7 @@ export default class HeaderHome extends Component { { - store.name && ( + store.name && (store.isNostores === 0) && ( {store.name || '选择店铺'} diff --git a/src/pages/index.js b/src/pages/index.js index bfdf85edf..78e578814 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -98,21 +98,19 @@ export default class HomeIndex extends Component { is_open_official_account:is_open_official_account, is_open_store_status:isOpenStore }, async() => { - if(this.state.is_open_store_status){ - store.distributor_id = 0 - if (!isArray(store)) { - this.setState({ - curStore: store - }, () => { - this.fetchData() - }) - } - - }else { let isNeedLoacate = is_open_wechatapp_location == 1 ? true : false const options = this.$router.params const res = await entry.entryLaunch(options, isNeedLoacate) const { store } = res + const { is_open_store_status } = this.state + if(is_open_store_status){ //新增逻辑,如果开启了非门店自提流程,新增字段 + store.store_id=0, //总店distribution_id + store.isNostores=1 //是否开启1,代表开启 + }else{ + //store.store_id=-1 + store.isNostores=0 //0 未开启 + } + Taro.setStorageSync('curStore', store) if (!isArray(store)) { this.setState({ curStore: store @@ -120,7 +118,6 @@ export default class HomeIndex extends Component { this.fetchData() }) } - } }) } @@ -154,12 +151,16 @@ export default class HomeIndex extends Component { componentDidShow = () => { const options = this.$router.params const { curStore } = this.state + console.log('curStore---->',curStore) const curStoreLocal = Taro.getStorageSync('curStore') + const localdis_id = curStoreLocal && curStoreLocal.isNostores == 1 ? 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: [], @@ -319,11 +320,13 @@ export default class HomeIndex extends Component { } async fetchInfo(cb) { const { curStore } = this.state + console.log('curStore ----dfd',curStore) + const curdis_id = curStore.isNostores && curStore.isNostores == 1 ? 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 @@ -481,7 +484,7 @@ export default class HomeIndex extends Component { if (!this.props.store) { return } - // 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 ( { diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index 48dfdccfd..7b3947950 100644 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -82,14 +82,22 @@ export default class Detail extends Component { },async()=>{ const { is_open_store_status }= this.state if (APP_PLATFORM === 'standard') { - const { distributor_id } = Taro.getStorageSync('curStore') + // const { distributor_id } = Taro.getStorageSync('curStore') + const curStore = Taro.getStorageSync('curStore') + console.log('curStoredfdf---->',curStore) if (!options.dtid || options.dtid !== 0) { - options.dtid = is_open_store_status ? '' : distributor_id + options.dtid = curStore.isNostores == 1 ? '': curStore.distributor_id } - // if(is_open_store_status){ - // delete options.dtid - // } const entryData = await entry.entryLaunch(options, true) + const{store} = entryData + if(is_open_store_status){ //新增逻辑,如果开启了非门店自提流程,新增字段 + store.store_id=0, //总店distribution_id + store.isNostores=1 //是否开启1,代表开启 + }else{ + //store.store_id=-1 + store.isNostores=0 //0 未开启 + } + Taro.setStorageSync('curStore', store) id = entryData.id uid = entryData.uid } @@ -177,10 +185,11 @@ export default class Detail extends Component { onShareAppMessage() { const { info } = this.state - const { distributor_id } = Taro.getStorageSync('curStore') + // 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 id = APP_PLATFORM === 'standard' ? curStore.isNostores === 1 ? curStore.store_id: curStore.distributor_id : infoId Tracker.dispatch("GOODS_SHARE_TO_CHANNEL_CLICK", { ...info, shareType: "分享给好友" @@ -194,10 +203,11 @@ export default class Detail extends Component { onShareTimeline() { const { info } = this.state - const { distributor_id } = Taro.getStorageSync('curStore') + // 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 id = APP_PLATFORM === 'standard' ? curStore.isNostores === 1 ? curStore.store_id: curStore.distributor_id : infoId return { title: info.item_name, query: `id=${info.item_id}&dtid=${id}&uid=${userId}`, @@ -230,7 +240,7 @@ export default class Detail extends Component { } async fetchInfo(itemId, goodsId) { - const { distributor_id } = Taro.getStorageSync('curStore') + const { distributor_id,isNostores,store_id } = Taro.getStorageSync('curStore') let id = '' if (itemId) { id = itemId @@ -241,7 +251,7 @@ export default class Detail extends Component { const param = { goods_id: goodsId } if (APP_PLATFORM === 'standard') { - param.distributor_id = distributor_id  + param.distributor_id = isNostores == 1 ? store_id : distributor_id  } else { param.distributor_id  = this.$router.params.dtid } @@ -456,8 +466,10 @@ export default class Detail extends Component { handlePackageClick = () => { const { info } = 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 = curStore.isNostores === 1 ? curStore.store_id : curStore.distributor_id } Taro.navigateTo({ url: `/pages/item/package-list?id=${info.item_id}&distributor_id=${distributor_id}` @@ -526,10 +538,10 @@ export default class Detail extends Component { 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,isNostores,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' ? isNostores === 1 ? 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}) @@ -724,7 +736,8 @@ 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 id = APP_PLATFORM === 'standard' ? curStore.isNostores === 1 ? curStore.store_id :curStore.distributor_id : item.distributor_id const url = `/pages/item/espier-detail?id=${item.item_id}&dtid=${id}` Taro.navigateTo({ url @@ -735,8 +748,8 @@ export default class Detail extends Component { // const { distributor_id } = Taro.getStorageSync('curStore') let id = '' if (APP_PLATFORM === 'standard') { - const { distributor_id } = Taro.getStorageSync('curStore') - id = distributor_id + const { distributor_id,isNostores,store_id } = Taro.getStorageSync('curStore') + id = isNostores === 1 ? store_id : distributor_id } else { const { info } = this.state const { distributor_id } = info diff --git a/src/pages/item/list.js b/src/pages/item/list.js index e1449b452..1d5ca3a82 100644 --- a/src/pages/item/list.js +++ b/src/pages/item/list.js @@ -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) diff --git a/src/pages/store/ziti-list.js b/src/pages/store/ziti-list.js index 5d0abd1af..7c4ef5c80 100644 --- a/src/pages/store/ziti-list.js +++ b/src/pages/store/ziti-list.js @@ -90,6 +90,7 @@ export default class StoreZitiList extends Component { let res = await api.member.areaList() const nAreaList = pickBy(res, { label: 'label', + id: 'id', children: 'children', }) this.nAreaList = nAreaList @@ -180,7 +181,7 @@ export default class StoreZitiList extends Component { loading: true }) Taro.removeStorageSync('lnglat') - const store = await entry.getLocal(true,'0') + const store = await entry.getLocal(true) console.log('store---->',store) if (store) { // Taro.setStorageSync('curStore', store) @@ -220,6 +221,120 @@ export default class StoreZitiList extends Component { // Taro.setStorageSync('curStore', val) // Taro.navigateBack() // } + +// 选定开户地区 +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 } = 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, area } = info + this.setState({ + query: { + ...this.state.query, + province, + city, + area + } + }, () => { + this.resetPage() + this.setState({ + list: [] + }, () => { + this.nextPage() + }) + }) + this.setState({ list }) +} +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 } = this.state if(!list.length) return @@ -258,11 +373,11 @@ export default class StoreZitiList extends Component { onConfirm={this.handleConfirm.bind(this)} /> */} - diff --git a/src/utils/entry.js b/src/utils/entry.js index 2e4d1e1ec..564dce7b7 100644 --- a/src/utils/entry.js +++ b/src/utils/entry.js @@ -16,9 +16,9 @@ async function entryLaunch(data, isNeedLocate) { // 如果没有带店铺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 @@ -114,18 +114,18 @@ async function getLocal (isNeedLocate) { } } } - if(isOpenStore){ - store = { - distributor_id:0 - } - Taro.setStorageSync('curStore', store) - }else{ if (!store.status) { + if(isOpenStore){ //新增逻辑,如果开启了非门店自提流程,新增字段 + store.store_id=0, //总店distribution_id + store.isNostores=1 //是否开启1,代表开启 + }else{ + //store.store_id=-1 + store.isNostores=0 //0 未开启 + } Taro.setStorageSync('curStore', store) } else { Taro.setStorageSync('curStore', []) } - } return store From 6cefd5a07a2604103ec7de7ba5b284e05719eb0b Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Wed, 25 Nov 2020 15:10:42 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E9=9D=9E=E9=97=A8=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E6=B5=81=E7=A8=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index.js | 28 ++++++++-------- src/pages/item/espier-detail.js | 51 ++++++++++++++++-------------- src/pages/store/comps/list-item.js | 3 +- src/pages/store/list.js | 11 +++++-- src/pages/store/ziti-list.js | 6 ++-- src/utils/entry.js | 9 ++++++ 6 files changed, 66 insertions(+), 42 deletions(-) diff --git a/src/pages/index.js b/src/pages/index.js index 78e578814..f7a3830f1 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -89,28 +89,28 @@ export default class HomeIndex extends Component { async fetchSetInfo() { const setUrl = '/pagestemplate/setInfo' const {is_open_recommend, is_open_scan_qrcode, is_open_wechatapp_location,is_open_official_account} = await req.get(setUrl) - const isOpenStore = await entry.getStoreStatus() + //const isOpenStore = await entry.getStoreStatus() let store = {} this.setState({ 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_store_status:isOpenStore + //is_open_store_status:isOpenStore }, 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 - const { is_open_store_status } = this.state - if(is_open_store_status){ //新增逻辑,如果开启了非门店自提流程,新增字段 - store.store_id=0, //总店distribution_id - store.isNostores=1 //是否开启1,代表开启 - }else{ - //store.store_id=-1 - store.isNostores=0 //0 未开启 - } - Taro.setStorageSync('curStore', store) + // const { is_open_store_status } = this.state + // if(is_open_store_status){ //新增逻辑,如果开启了非门店自提流程,新增字段 + // store.store_id=0, //总店distribution_id + // store.isNostores=1 //是否开启1,代表开启 + // }else{ + // //store.store_id=-1 + // store.isNostores=0 //0 未开启 + // } + // Taro.setStorageSync('curStore', store) if (!isArray(store)) { this.setState({ curStore: store @@ -151,7 +151,6 @@ export default class HomeIndex extends Component { componentDidShow = () => { const options = this.$router.params const { curStore } = this.state - console.log('curStore---->',curStore) const curStoreLocal = Taro.getStorageSync('curStore') const localdis_id = curStoreLocal && curStoreLocal.isNostores == 1 ? curStoreLocal.store_id : curStoreLocal.distributor_id //非自提门店判断 //const curdis_id = curStore && curStore.isNostores == 1 ? curStore.store_id : curStore.distributor_id @@ -320,7 +319,6 @@ export default class HomeIndex extends Component { } async fetchInfo(cb) { const { curStore } = this.state - console.log('curStore ----dfd',curStore) const curdis_id = curStore.isNostores && curStore.isNostores == 1 ? curStore.store_id : curStore.distributor_id if (!curStore.distributor_id && curStore.distributor_id !== 0) { return @@ -395,10 +393,12 @@ export default class HomeIndex extends Component { this.setState({ show_tabBar:false }) - } setTimeout(() => { S.login(this, true) }, 1000) + }else { + this.fetchSetInfo() + } }else { this.fetchSetInfo() } diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index 7b3947950..d5adeb95e 100644 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -84,20 +84,19 @@ export default class Detail extends Component { if (APP_PLATFORM === 'standard') { // const { distributor_id } = Taro.getStorageSync('curStore') const curStore = Taro.getStorageSync('curStore') - console.log('curStoredfdf---->',curStore) if (!options.dtid || options.dtid !== 0) { options.dtid = curStore.isNostores == 1 ? '': curStore.distributor_id } const entryData = await entry.entryLaunch(options, true) - const{store} = entryData - if(is_open_store_status){ //新增逻辑,如果开启了非门店自提流程,新增字段 - store.store_id=0, //总店distribution_id - store.isNostores=1 //是否开启1,代表开启 - }else{ - //store.store_id=-1 - store.isNostores=0 //0 未开启 - } - Taro.setStorageSync('curStore', store) + // const{store} = entryData + // if(is_open_store_status){ //新增逻辑,如果开启了非门店自提流程,新增字段 + // store.store_id=0, //总店distribution_id + // store.isNostores=1 //是否开启1,代表开启 + // }else{ + // //store.store_id=-1 + // store.isNostores=0 //0 未开启 + // } + // Taro.setStorageSync('curStore', store) id = entryData.id uid = entryData.uid } @@ -105,11 +104,17 @@ export default class Detail extends Component { this.uid = uid } if(!S.getAuthToken()){ - setTimeout(() => { - this.checkWhite() - }, 1000) - } - this.fetchInfo(id) + const { status } = await api.wx.getWhiteList() + if(status == true){ + setTimeout(() => { + S.login(this, true) + }, 1000) + }else{ + this.fetchInfo(id) + } + }else{ + this.fetchInfo(id) + } this.getEvaluationList(id) // 浏览记录 if (S.getAuthToken()) { @@ -230,14 +235,14 @@ export default class Detail extends Component { console.log(e) } } - async checkWhite () { - const { status } = await api.wx.getWhiteList() - if(status == true){ - setTimeout(() => { - S.login(this, true) - }, 1000) - } - } + // async checkWhite () { + // const { status } = await api.wx.getWhiteList() + // if(status == true){ + // setTimeout(() => { + // S.login(this, true) + // }, 1000) + // } + // } async fetchInfo(itemId, goodsId) { const { distributor_id,isNostores,store_id } = Taro.getStorageSync('curStore') diff --git a/src/pages/store/comps/list-item.js b/src/pages/store/comps/list-item.js index b8f6e7e1a..b50de594a 100644 --- a/src/pages/store/comps/list-item.js +++ b/src/pages/store/comps/list-item.js @@ -23,6 +23,7 @@ export default class StoreListItem extends Component { render () { const { info, onClick,isStore } = this.props if (!info) return null + const distance = info.distance && (info.distance*1).toFixed(2) return ( - {info.distance}{info.distance_unit} + {distance}{info.distance_unit} ) } diff --git a/src/pages/store/list.js b/src/pages/store/list.js index 6e5104598..66a72ba8e 100644 --- a/src/pages/store/list.js +++ b/src/pages/store/list.js @@ -53,9 +53,16 @@ export default class StoreList extends Component { page, pageSize } - const { list, total_count: total} = await api.shop.list(query) - + const isOpenStore = await entry.getStoreStatus() + list.map(item=>{ + if(isOpenStore){ + item.store_id = 0 + item.isNostores = 1 + }else{ + item.isNostores = 0 + } + }) this.setState({ list: [...this.state.list, ...list], query diff --git a/src/pages/store/ziti-list.js b/src/pages/store/ziti-list.js index 7c4ef5c80..1a7f3d960 100644 --- a/src/pages/store/ziti-list.js +++ b/src/pages/store/ziti-list.js @@ -60,6 +60,7 @@ export default class StoreZitiList extends Component { async fetch (params) { const isOpenStore = await entry.getStoreStatus() + const{ shop_id } =this.$router.params const { page_no: page, page_size: pageSize } = params const { selectParams, areaList, tagsList, curTagId } = this.state const { cart_type} = this.$router.params @@ -85,7 +86,9 @@ export default class StoreZitiList extends Component { distance:({ distance }) => (distance*1).toFixed(2), distance_show:({ distance_show }) => (distance_show*1).toFixed(2), distance_unit:'distance_unit', - is_checked:'is_checked' + is_checked:'is_checked', + store_id:isOpenStore ? '' : 0, + isNostores:isOpenStore ? 1 : 0 }) let res = await api.member.areaList() const nAreaList = pickBy(res, { @@ -202,7 +205,6 @@ export default class StoreZitiList extends Component { } handleSelectStore = (item) =>{ const { list } = this.state - const{ shop_id } =this.$router.params list.map(v =>{ v.is_checked = false, v.distributor_id == item.distributor_id && (v.is_checked = true) diff --git a/src/utils/entry.js b/src/utils/entry.js index 564dce7b7..b4fb3190f 100644 --- a/src/utils/entry.js +++ b/src/utils/entry.js @@ -13,6 +13,7 @@ async function entryLaunch(data, isNeedLocate) { } else { options = data } + console.log('options---->',options) // 如果没有带店铺id if (!options.dtid) { @@ -202,7 +203,15 @@ 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) { + if(isOpenStore){ //新增逻辑,如果开启了非门店自提流程,新增字段 + res.store_id=0, //总店distribution_id为0 + res.isNostores=1 //是否开启,1,代表开启 + }else{ + //store.store_id=-1 + res.isNostores=0 //0 未开启 + } Taro.setStorageSync('curStore', res) } else { Taro.setStorageSync('curStore', []) From f537de9b2825ee77494a3b919a448bc9fd24f0c8 Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Thu, 26 Nov 2020 13:04:14 +0800 Subject: [PATCH 08/21] =?UTF-8?q?=E7=BB=93=E7=AE=97=E9=A1=B5=E9=9D=9E?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E8=87=AA=E6=8F=90=E9=80=BB=E8=BE=91=E6=96=B0?= =?UTF-8?q?=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/espier-checkout.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 0265609b1..1588a228e 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -277,13 +277,11 @@ export default class CartCheckout extends Component { id = dtid; } if(zitiShop){ + ztparams.distributor_id = zitiShop.distributor_id if(isOpenStore){ - ztparams.lat = zitiShop.lat - ztparams.lng = zitiShop.lng ztparams.cart_type = cart_type ztparams.isNostores = 1 }else{ - ztparams.distributor_id = zitiShop.distributor_id ztparams.isNostores = 0 } }else{ @@ -298,14 +296,12 @@ export default class CartCheckout extends Component { ztparams.isNostores = 0 } } - console.log('params33---------->',ztparams) const shopInfo = await api.shop.getShop(ztparams); - console.log('shopInfo------>',shopInfo) this.setState({ curStore: shopInfo, - receiptType: shopInfo.is_delivery ? "logistics" : "ziti", - express: shopInfo.is_delivery ? true : false, - isOpenStore + receiptType: zitiShop ? 'ziti' : shopInfo.is_delivery ? "logistics" : "ziti", + express: zitiShop ? false : shopInfo.is_delivery ? true : false, + isOpenStore, },()=>{ this.calcOrder() }); @@ -528,15 +524,15 @@ export default class CartCheckout extends Component { }; } 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 { payType, receiptType, point_use,isOpenStore,curStore } = this.state; const { coupon, drugInfo,zitiShop } = this.props; - console.log('zitiShop----->',zitiShop) if (drugInfo) { this.setState({ drug: drugInfo @@ -555,7 +551,8 @@ export default class CartCheckout extends Component { member_discount: 0, coupon_discount: 0, pay_type: payType, - distributor_id:zitiShop ? zitiShop.distributor_id : this.getShopId() || (shop_id === "undefined" ? 0 : shop_id), + //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" ? 0 : shop_id), ...drugInfo, point_use: point_use }; @@ -723,11 +720,12 @@ export default class CartCheckout extends Component { handleSwitchExpress = key => { const receiptType = JSON.parse(key) ? "logistics" : "ziti"; + const { curStore } = Taro.getStorageSync('curStore') this.clearPoint(); this.setState( { express: JSON.parse(key), - receiptType + receiptType, }, () => { this.calcOrder(); @@ -1439,7 +1437,6 @@ export default class CartCheckout extends Component { : (coupon.value && coupon.value.title) || ""; //const isBtnDisabled = !address const isBtnDisabled = express ? !address : false; - console.log('curStorer44555--->',curStore) return ( {showAddressPicker === false ? ( From 321f7cb3c57cb41bb26bc7eb355723f544331fd1 Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Thu, 26 Nov 2020 13:43:49 +0800 Subject: [PATCH 09/21] =?UTF-8?q?=E9=9D=9E=E8=87=AA=E6=8F=90=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E6=B5=81=E7=A8=8B=20=E6=96=B0=E5=A2=9E=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/espier-checkout.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 1588a228e..b4a0fcca0 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -268,8 +268,7 @@ export default class CartCheckout extends Component { const { shop_id, scene,cart_type} = this.$router.params; const isOpenStore = await entry.getStoreStatus() const { zitiShop } = this.props; - // const {curStore} = this.state - // const shopInfo = await api.shop.getShop({distributor_id: shop_id}) + const params = this.getParams() let id = shop_id; let ztparams ={} if (scene) { @@ -280,7 +279,9 @@ export default class CartCheckout extends Component { ztparams.distributor_id = zitiShop.distributor_id if(isOpenStore){ ztparams.cart_type = cart_type + ztparams.order_type = params.order_type ztparams.isNostores = 1 + }else{ ztparams.isNostores = 0 } @@ -290,6 +291,7 @@ export default class CartCheckout extends Component { ztparams.lat = lnglat.latitude ztparams.lng = lnglat.longitude ztparams.cart_type = cart_type + ztparams.order_type = params.order_type ztparams.isNostores = 1 }else{ ztparams.distributor_id = id From ed91103ea20aad8700001ec3c743eac60f4d394d Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Thu, 26 Nov 2020 14:08:28 +0800 Subject: [PATCH 10/21] =?UTF-8?q?=E9=97=A8=E5=BA=97=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=96=B0=E5=A2=9E=E5=8F=82=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/espier-checkout.js | 3 ++- src/pages/store/ziti-list.js | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index b4a0fcca0..39ce5a63d 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -777,8 +777,9 @@ export default class CartCheckout extends Component { }; handleEditZitiClick =(id) =>{ const {cart_type} = this.$router.params; + const params = this.getParams() Taro.navigateTo({ - url: `/pages/store/ziti-list?shop_id=${id}&cart_type=${cart_type}` + url: `/pages/store/ziti-list?shop_id=${id}&cart_type=${cart_type}&order_type=${params.order_type}` }) } diff --git a/src/pages/store/ziti-list.js b/src/pages/store/ziti-list.js index 1a7f3d960..4b1dcd103 100644 --- a/src/pages/store/ziti-list.js +++ b/src/pages/store/ziti-list.js @@ -9,6 +9,7 @@ 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) => ({ @@ -29,6 +30,7 @@ export default class StoreZitiList extends Component { is_open_store_status:false, multiIndex:[], areaList: [], + info: {}, } } config = { @@ -60,15 +62,16 @@ export default class StoreZitiList extends Component { async fetch (params) { const isOpenStore = await entry.getStoreStatus() - const{ shop_id } =this.$router.params const { page_no: page, page_size: pageSize } = params const { selectParams, areaList, tagsList, curTagId } = this.state - const { cart_type} = this.$router.params + const { shop_id,order_type, cart_type} = this.$router.params const query = { ...this.state.query, page, pageSize, - cart_type + cart_type, + order_type, + isNostores:isOpenStore ? 1 : 0 } const { list, total_count: total} = await api.shop.list(query) @@ -93,7 +96,6 @@ export default class StoreZitiList extends Component { let res = await api.member.areaList() const nAreaList = pickBy(res, { label: 'label', - id: 'id', children: 'children', }) this.nAreaList = nAreaList @@ -226,6 +228,7 @@ export default class StoreZitiList extends Component { // 选定开户地区 handleClickPicker = () => { + console.log('handleClickPicker') let arrProvice = [] let arrCity = [] let arrCounty = [] @@ -253,7 +256,8 @@ handleClickPicker = () => { } bindMultiPickerChange = async (e) => { - const { info } = this.state + console.log('bindMultiPickerChange') + const { info,query } = this.state this.nAreaList.map((item, index) => { if(index === e.detail.value[0]) { info.province = item.label @@ -271,12 +275,14 @@ bindMultiPickerChange = async (e) => { }) const { province, city, area } = info + delete query.lat + delete query.lng this.setState({ query: { ...this.state.query, province, city, - area + area, } }, () => { this.resetPage() @@ -286,7 +292,7 @@ bindMultiPickerChange = async (e) => { this.nextPage() }) }) - this.setState({ list }) + // this.setState({ list }) } bindMultiPickerColumnChange = (e) => { const { areaList, multiIndex } = this.state From dbd413944ee1eea62380a71e6718385291787d6b Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Thu, 26 Nov 2020 14:58:07 +0800 Subject: [PATCH 11/21] =?UTF-8?q?=E9=9D=9E=E9=97=A8=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E6=B5=81=E7=A8=8B=E5=8A=A0=E5=8F=82=E6=95=B0=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/espier-checkout.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 39ce5a63d..ac8754583 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -553,8 +553,17 @@ export default class CartCheckout extends Component { member_discount: 0, coupon_discount: 0, pay_type: payType, + 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" ? 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" ? 0 : shop_id), ...drugInfo, point_use: point_use }; @@ -975,7 +984,7 @@ export default class CartCheckout extends Component { // if (!this.state.address) { // return S.toast('请选择地址') // } - const { payType, total, identity } = this.state; + const { payType, total, identity,isOpenStore,receiptType } = this.state; const { type, goodType, cart_type } = this.$router.params; // const { payType, total,point_use } = this.state @@ -1024,6 +1033,17 @@ export default class CartCheckout extends Component { if (APP_PLATFORM === "standard" && cart_type !== "cart") { const { distributor_id,isNostores,store_id } = Taro.getStorageSync("curStore"); params.distributor_id = this.getShopId() || isNostores === 1 ? store_id :distributor_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" ? 0 : shop_id), + } delete params.items; From 2706173da4f69eb93659d9254ef443dd4ce89fcf Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Thu, 26 Nov 2020 16:44:05 +0800 Subject: [PATCH 12/21] =?UTF-8?q?=E9=9D=9E=E9=97=A8=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E6=B5=81=E7=A8=8B=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/espier-checkout.js | 34 ++++++++++++++++-------------- src/pages/store/comps/list-item.js | 5 ++--- src/pages/store/ziti-list.js | 23 +++++++++++++------- 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index ac8754583..4da18fb38 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -265,7 +265,11 @@ export default class CartCheckout extends Component { } async fetchZiTiShop() { - const { shop_id, scene,cart_type} = this.$router.params; + const { shop_id, scene,cart_type,seckill_id = null,ticket = null, + source, + goodType, + bargain_id = "" + } = this.$router.params; const isOpenStore = await entry.getStoreStatus() const { zitiShop } = this.props; const params = this.getParams() @@ -281,6 +285,9 @@ export default class CartCheckout extends Component { ztparams.cart_type = cart_type ztparams.order_type = params.order_type ztparams.isNostores = 1 + ztparams.seckill_id = seckill_id + ztparams.seckill_ticket = ticket + ztparams.iscrossborder = goodType === 'cross' ? 1 : '' }else{ ztparams.isNostores = 0 @@ -293,6 +300,10 @@ export default class CartCheckout extends Component { ztparams.cart_type = cart_type ztparams.order_type = params.order_type ztparams.isNostores = 1 + ztparams.seckill_id = seckill_id + ztparams.seckill_ticket = ticket + ztparams.iscrossborder = goodType === 'cross' ? 1 : '' + }else{ ztparams.distributor_id = id ztparams.isNostores = 0 @@ -785,10 +796,10 @@ export default class CartCheckout extends Component { }); }; handleEditZitiClick =(id) =>{ - const {cart_type} = this.$router.params; + 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}` + 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}` }) } @@ -984,7 +995,7 @@ export default class CartCheckout extends Component { // if (!this.state.address) { // return S.toast('请选择地址') // } - const { payType, total, identity,isOpenStore,receiptType } = this.state; + const { payType, total, identity,isOpenStore,curStore } = this.state; const { type, goodType, cart_type } = this.$router.params; // const { payType, total,point_use } = this.state @@ -1031,18 +1042,8 @@ export default class CartCheckout extends Component { try { let params = this.getParams(); if (APP_PLATFORM === "standard" && cart_type !== "cart") { - const { distributor_id,isNostores,store_id } = Taro.getStorageSync("curStore"); - params.distributor_id = this.getShopId() || isNostores === 1 ? store_id :distributor_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" ? 0 : shop_id), + const { distributor_id } = Taro.getStorageSync("curStore"); + params.distributor_id = isOpenStore ? curStore.distributor_id : this.getShopId() || distributor_id; } @@ -1448,6 +1449,7 @@ export default class CartCheckout extends Component { // const { curStore } = this.state const { type, goodType, bargain_id } = this.$router.params; const isDrug = type === "drug"; + console.log('isOpenStore---->',isOpenStore) if (!info) { return ; diff --git a/src/pages/store/comps/list-item.js b/src/pages/store/comps/list-item.js index b50de594a..de13db4d4 100644 --- a/src/pages/store/comps/list-item.js +++ b/src/pages/store/comps/list-item.js @@ -23,8 +23,7 @@ export default class StoreListItem extends Component { render () { const { info, onClick,isStore } = this.props if (!info) return null - const distance = info.distance && (info.distance*1).toFixed(2) - + const distance = info.distance ? (info.distance*1).toFixed(2) : false return ( { - info.distance && ( + distance && ( {distance}{info.distance_unit} diff --git a/src/pages/store/ziti-list.js b/src/pages/store/ziti-list.js index 4b1dcd103..394952255 100644 --- a/src/pages/store/ziti-list.js +++ b/src/pages/store/ziti-list.js @@ -64,14 +64,17 @@ export default class StoreZitiList extends Component { const isOpenStore = await entry.getStoreStatus() const { page_no: page, page_size: pageSize } = params const { selectParams, areaList, tagsList, curTagId } = this.state - const { shop_id,order_type, cart_type} = this.$router.params + const { shop_id,order_type, cart_type,seckill_id,ticket,goodType} = this.$router.params const query = { ...this.state.query, page, pageSize, cart_type, order_type, - isNostores:isOpenStore ? 1 : 0 + seckill_id, + seckill_ticket:ticket, + isNostores:isOpenStore ? 1 : 0, + iscrossborder:goodType ==='cross' ? 1 : '' } const { list, total_count: total} = await api.shop.list(query) @@ -86,8 +89,8 @@ export default class StoreZitiList extends Component { lat:'lat', lng:'lng', distributor_self:'distributor_self', - distance:({ distance }) => (distance*1).toFixed(2), - distance_show:({ distance_show }) => (distance_show*1).toFixed(2), + distance:'distance', + distance_show:'distance_show', distance_unit:'distance_unit', is_checked:'is_checked', store_id:isOpenStore ? '' : 0, @@ -258,6 +261,7 @@ handleClickPicker = () => { bindMultiPickerChange = async (e) => { console.log('bindMultiPickerChange') const { info,query } = this.state + console.log('info---->',info) this.nAreaList.map((item, index) => { if(index === e.detail.value[0]) { info.province = item.label @@ -273,8 +277,7 @@ bindMultiPickerChange = async (e) => { }) } }) - - const { province, city, area } = info + const { province, city, area,county } = info delete query.lat delete query.lng this.setState({ @@ -282,7 +285,7 @@ bindMultiPickerChange = async (e) => { ...this.state.query, province, city, - area, + area:county, } }, () => { this.resetPage() @@ -364,6 +367,8 @@ bindMultiPickerColumnChange = (e) => { render () { const { list, scrollTop, showBackToTop, loading, current, query,is_open_store_status,areaList,multiIndex,page } = this.state const { shop_id } = this.$router.params + console.log('areaList---->',areaList) + console.log('multiIndex--->',multiIndex) return ( { ? 定位中... : { - current + multiIndex.length > 0 + ? {areaList[0][multiIndex[0]]}{areaList[1][multiIndex[1]]}{areaList[2][multiIndex[2]]} + : current ? {current.regions[0]}{current.regions[1]}{current.regions[2]} :'定位失败' } From 3ac5ac6ceb9b65b0d053b90b5ba2965909c6a74d Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Thu, 26 Nov 2020 18:57:40 +0800 Subject: [PATCH 13/21] =?UTF-8?q?=E9=9D=9E=E9=97=A8=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/goods-buy-panel/index.js | 3 +- src/pages/cart/espier-checkout.js | 4 ++- src/pages/store/ziti-list.js | 48 +++++++++++++++---------- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/components/goods-buy-panel/index.js b/src/components/goods-buy-panel/index.js index 511655b2d..870cf7ca2 100644 --- a/src/components/goods-buy-panel/index.js +++ b/src/components/goods-buy-panel/index.js @@ -279,8 +279,9 @@ export default class GoodsBuyPanel extends Component { const isDrug = special_type === "drug"; const { item_id } = this.noSpecs ? info : skuInfo; const { distributor_id } = info; + console.log('distributor_id---->',distributor_id) const curStore = Taro.getStorageSync('curStore'); - let id = curStore.isNostores == 1 ? curStore.store_id: distributor_id + let id = curStore.isNostores === 1 ? curStore.store_id: distributor_id let url = `/pages/cart/espier-checkout`; this.setState({ diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 4da18fb38..92673dc41 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -226,6 +226,7 @@ export default class CartCheckout extends Component { // this.handleAddressChange(this.props.defaultAddress) this.props.onAddressChoose(null); this.props.onChangeZitiStore(null); + Taro.removeStorageSync('cityInfo') this.getSalespersonNologin(); // this.getShop() this.fetchAddress(); @@ -310,6 +311,7 @@ export default class CartCheckout extends Component { } } const shopInfo = await api.shop.getShop(ztparams); + Taro.setStorageSync('ztStore',shopInfo) this.setState({ curStore: shopInfo, receiptType: zitiShop ? 'ziti' : shopInfo.is_delivery ? "logistics" : "ziti", @@ -574,7 +576,7 @@ export default class CartCheckout extends Component { : curStore ? curStore.distributor_id : this.getShopId() || (shop_id === "undefined" ? 0 : shop_id) - : this.getShopId() || (shop_id === "undefined" ? 0 : shop_id), + : this.getShopId() || (shop_id === "undefined" ? curStorageStore.distributor_id : shop_id), ...drugInfo, point_use: point_use }; diff --git a/src/pages/store/ziti-list.js b/src/pages/store/ziti-list.js index 394952255..752b8a017 100644 --- a/src/pages/store/ziti-list.js +++ b/src/pages/store/ziti-list.js @@ -31,6 +31,7 @@ export default class StoreZitiList extends Component { multiIndex:[], areaList: [], info: {}, + currCityinfo:{} } } config = { @@ -39,6 +40,7 @@ export default class StoreZitiList extends Component { componentDidMount () { const lnglat = Taro.getStorageSync('lnglat') + const cityInfo = Taro.getStorageSync('ztStore') let query = {} if (lnglat) { const { latitude, longitude } = lnglat @@ -47,11 +49,19 @@ export default class StoreZitiList extends Component { lng: lnglat.longitude } } + if(cityInfo){ + query = { + province:cityInfo.province, + city:cityInfo.city, + area:cityInfo.county, + } + } const store = Taro.getStorageSync('curStore') if (store) { this.setState({ current: store, - query + query, + currCityinfo:cityInfo ? cityInfo : {} }, () => { this.nextPage() }) @@ -62,6 +72,7 @@ export default class StoreZitiList extends Component { async fetch (params) { const isOpenStore = await entry.getStoreStatus() + const cityInfo = Taro.getStorageSync('cityInfo') const { page_no: page, page_size: pageSize } = params const { selectParams, areaList, tagsList, curTagId } = this.state const { shop_id,order_type, cart_type,seckill_id,ticket,goodType} = this.$router.params @@ -86,13 +97,13 @@ export default class StoreZitiList extends Component { 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', - is_checked:'is_checked', store_id:isOpenStore ? '' : 0, isNostores:isOpenStore ? 1 : 0 }) @@ -123,6 +134,7 @@ export default class StoreZitiList extends Component { query, is_open_store_status:isOpenStore, areaList: [arrProvice, arrCity, arrCounty], + //info:cityInfo ? cityInfo : {} }) return { @@ -190,7 +202,6 @@ export default class StoreZitiList extends Component { }) Taro.removeStorageSync('lnglat') const store = await entry.getLocal(true) - console.log('store---->',store) if (store) { // Taro.setStorageSync('curStore', store) this.resetPage() @@ -261,7 +272,6 @@ handleClickPicker = () => { bindMultiPickerChange = async (e) => { console.log('bindMultiPickerChange') const { info,query } = this.state - console.log('info---->',info) this.nAreaList.map((item, index) => { if(index === e.detail.value[0]) { info.province = item.label @@ -277,7 +287,7 @@ bindMultiPickerChange = async (e) => { }) } }) - const { province, city, area,county } = info + const { province, city,county } = info delete query.lat delete query.lng this.setState({ @@ -295,7 +305,7 @@ bindMultiPickerChange = async (e) => { this.nextPage() }) }) - // this.setState({ list }) + this.setState({ info }) } bindMultiPickerColumnChange = (e) => { const { areaList, multiIndex } = this.state @@ -347,7 +357,7 @@ bindMultiPickerColumnChange = (e) => { } handleChangeStore = ()=>{ - let { list } = this.state + let { list,info } = this.state if(!list.length) return const selected = list.filter(v=>v.is_checked) if(!selected.length){ @@ -365,10 +375,7 @@ bindMultiPickerColumnChange = (e) => { } render () { - const { list, scrollTop, showBackToTop, loading, current, query,is_open_store_status,areaList,multiIndex,page } = this.state - const { shop_id } = this.$router.params - console.log('areaList---->',areaList) - console.log('multiIndex--->',multiIndex) + const { list, scrollTop, showBackToTop, loading, current, query,is_open_store_status,areaList,multiIndex,page,info,currCityinfo } = this.state return ( { ? 定位中... : { - multiIndex.length > 0 - ? {areaList[0][multiIndex[0]]}{areaList[1][multiIndex[1]]}{areaList[2][multiIndex[2]]} - : current - ? {current.regions[0]}{current.regions[1]}{current.regions[2]} + info && info.province + ? {info.province}{info.city}{info.county} + : currCityinfo + ? {currCityinfo.regions[0]}{currCityinfo.regions[1]}{currCityinfo.regions[2]} :'定位失败' } @@ -453,9 +460,14 @@ bindMultiPickerColumnChange = (e) => { ) }) } - - 确定 - + { + list.length && ( + + 确定 + + ) + } + { page.isLoading ? 正在加载... : null } { From df0acffac714a02746128b92a7fc5c08221d429c Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Fri, 27 Nov 2020 11:07:40 +0800 Subject: [PATCH 14/21] =?UTF-8?q?=E9=9D=9E=E9=97=A8=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E6=B5=81=E7=A8=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/goods-buy-panel/index.js | 3 +- src/pages/cart/espier-checkout.js | 72 ++++++++++++----------- src/pages/cart/espier-index.js | 8 +-- src/pages/home/wgts/header-home.js | 24 ++++---- src/pages/index.js | 29 ++++------ src/pages/item/espier-detail.js | 77 +++++++++++-------------- src/utils/entry.js | 30 +++++----- 7 files changed, 110 insertions(+), 133 deletions(-) diff --git a/src/components/goods-buy-panel/index.js b/src/components/goods-buy-panel/index.js index 870cf7ca2..2457b726a 100644 --- a/src/components/goods-buy-panel/index.js +++ b/src/components/goods-buy-panel/index.js @@ -279,9 +279,8 @@ export default class GoodsBuyPanel extends Component { const isDrug = special_type === "drug"; const { item_id } = this.noSpecs ? info : skuInfo; const { distributor_id } = info; - console.log('distributor_id---->',distributor_id) const curStore = Taro.getStorageSync('curStore'); - let id = curStore.isNostores === 1 ? curStore.store_id: distributor_id + let id = curStore.isNostores === 1 ? curStore.store_id: curStore.distributor_id let url = `/pages/cart/espier-checkout`; this.setState({ diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 92673dc41..34253a762 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -132,7 +132,7 @@ export default class CartCheckout extends Component { }; } - componentDidMount() { + async componentDidMount() { // this.fetchAddress() if (this.$router.params.scene) { console.log(normalizeQuerys(this.$router.params)); @@ -154,6 +154,10 @@ export default class CartCheckout extends Component { return; } + const isOpenStore = await entry.getStoreStatus() + this.setState({ + isOpenStore + }) const { cart_type, pay_type: payType, shop_id } = this.$router.params; let curStore = null, info = null; @@ -266,59 +270,57 @@ export default class CartCheckout extends Component { } async fetchZiTiShop() { - const { shop_id, scene,cart_type,seckill_id = null,ticket = null, - source, - goodType, - bargain_id = "" - } = this.$router.params; - const isOpenStore = await entry.getStoreStatus() + const { shop_id, scene,cart_type,seckill_id = null,ticket = null} = this.$router.params; const { zitiShop } = this.props; const params = this.getParams() + const { isOpenStore} = this.state let id = shop_id; let ztparams ={} if (scene) { const { dtid } = normalizeQuerys(this.$router.params); id = dtid; } - if(zitiShop){ - ztparams.distributor_id = zitiShop.distributor_id - if(isOpenStore){ - ztparams.cart_type = cart_type - ztparams.order_type = params.order_type - ztparams.isNostores = 1 - ztparams.seckill_id = seckill_id - ztparams.seckill_ticket = ticket - ztparams.iscrossborder = goodType === 'cross' ? 1 : '' - - }else{ - ztparams.isNostores = 0 + if(isOpenStore) {//是否开启非门店自提 + ztparams = { + sNostores: 1,//1 开启 + order_type : params.order_type, + seckill_id: seckill_id, + seckill_ticket: ticket } - }else{ - if(isOpenStore){ + if(zitiShop){ + ztparams = { + ...ztparams, + distributor_id:zitiShop.distributor_id, + + } + }else { let lnglat = Taro.getStorageSync('lnglat') - ztparams.lat = lnglat.latitude - ztparams.lng = lnglat.longitude - ztparams.cart_type = cart_type - ztparams.order_type = params.order_type - ztparams.isNostores = 1 - ztparams.seckill_id = seckill_id - ztparams.seckill_ticket = ticket - ztparams.iscrossborder = goodType === 'cross' ? 1 : '' - - }else{ - ztparams.distributor_id = id - ztparams.isNostores = 0 + ztparams = { + ...ztparams, + lat: lnglat.latitude, + lng:lnglat.longitude, + cart_type: cart_type, + } + } + } else { + ztparams ={ + isNostores: 0//0 未开启 + } + if(!zitiShop){ + ztparams ={ + ...ztparams, + distributor_id: id } } + } const shopInfo = await api.shop.getShop(ztparams); Taro.setStorageSync('ztStore',shopInfo) this.setState({ curStore: shopInfo, receiptType: zitiShop ? 'ziti' : shopInfo.is_delivery ? "logistics" : "ziti", express: zitiShop ? false : shopInfo.is_delivery ? true : false, - isOpenStore, },()=>{ - this.calcOrder() + isOpenStore && this.calcOrder() }); } diff --git a/src/pages/cart/espier-index.js b/src/pages/cart/espier-index.js index 2e9a0d8f8..4792f2763 100644 --- a/src/pages/cart/espier-index.js +++ b/src/pages/cart/espier-index.js @@ -219,12 +219,8 @@ export default class CartIndex extends Component { const { type = 'distributor' } = this.$router.params const isOpenStore = await entry.getStoreStatus()//非门店自提 const params = { - shop_type: type - } - if(isOpenStore){ - params.isNostores = 1 - }else{ - params.isNostores = 0 + shop_type: type, + isNostores: isOpenStore ? 1 : 0//是否开启非门店自提流程 } if (cartTypeLocal === 'cross') { params.iscrossborder = 1 diff --git a/src/pages/home/wgts/header-home.js b/src/pages/home/wgts/header-home.js index e6bf253bb..028c6f146 100644 --- a/src/pages/home/wgts/header-home.js +++ b/src/pages/home/wgts/header-home.js @@ -52,22 +52,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 ( - { - store.name && (store.isNostores === 0) && ( - - - {store.name || '选择店铺'} - - - ) - } - + { + isNoStores && store.name && ( + + + {store.name || '选择店铺'} + + + ) + } + { Taro.getEnv() !== 'WEB' && isOpenScanQrcode==1 && diff --git a/src/pages/index.js b/src/pages/index.js index f7a3830f1..f6f557575 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -77,8 +77,11 @@ 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.fetchStoreStatus() api.wx.shareSetting({shareindex: 'index'}).then(res => { this.setState({ shareInfo: res @@ -89,28 +92,17 @@ export default class HomeIndex extends Component { async fetchSetInfo() { const setUrl = '/pagestemplate/setInfo' const {is_open_recommend, is_open_scan_qrcode, is_open_wechatapp_location,is_open_official_account} = await req.get(setUrl) - //const isOpenStore = await entry.getStoreStatus() - let store = {} this.setState({ 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_store_status:isOpenStore + }, 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 - // const { is_open_store_status } = this.state - // if(is_open_store_status){ //新增逻辑,如果开启了非门店自提流程,新增字段 - // store.store_id=0, //总店distribution_id - // store.isNostores=1 //是否开启1,代表开启 - // }else{ - // //store.store_id=-1 - // store.isNostores=0 //0 未开启 - // } - // Taro.setStorageSync('curStore', store) if (!isArray(store)) { this.setState({ curStore: store @@ -150,9 +142,9 @@ 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 && curStoreLocal.isNostores == 1 ? curStoreLocal.store_id : curStoreLocal.distributor_id //非自提门店判断 + 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) { @@ -318,8 +310,8 @@ export default class HomeIndex extends Component { } } async fetchInfo(cb) { - const { curStore } = this.state - const curdis_id = curStore.isNostores && curStore.isNostores == 1 ? curStore.store_id : curStore.distributor_id + 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 } @@ -474,7 +466,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 @@ -503,6 +495,7 @@ export default class HomeIndex extends Component { store={curStore} onClickItem={this.goStore.bind(this)} isOpenScanQrcode={is_open_scan_qrcode} + isOpenStoreStatus={is_open_store_status} /> } diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index d5adeb95e..6c9c2db16 100644 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -80,23 +80,14 @@ export default class Detail extends Component { this.setState({ is_open_store_status:isOpenStore },async()=>{ - const { is_open_store_status }= this.state if (APP_PLATFORM === 'standard') { + const { is_open_store_status } = this.state // const { distributor_id } = Taro.getStorageSync('curStore') const curStore = Taro.getStorageSync('curStore') if (!options.dtid || options.dtid !== 0) { - options.dtid = curStore.isNostores == 1 ? '': curStore.distributor_id + options.dtid = is_open_store_status ? '': curStore.distributor_id } const entryData = await entry.entryLaunch(options, true) - // const{store} = entryData - // if(is_open_store_status){ //新增逻辑,如果开启了非门店自提流程,新增字段 - // store.store_id=0, //总店distribution_id - // store.isNostores=1 //是否开启1,代表开启 - // }else{ - // //store.store_id=-1 - // store.isNostores=0 //0 未开启 - // } - // Taro.setStorageSync('curStore', store) id = entryData.id uid = entryData.uid } @@ -104,17 +95,9 @@ export default class Detail extends Component { this.uid = uid } if(!S.getAuthToken()){ - const { status } = await api.wx.getWhiteList() - if(status == true){ - setTimeout(() => { - S.login(this, true) - }, 1000) - }else{ - this.fetchInfo(id) - } - }else{ - this.fetchInfo(id) - } + this.checkWhite() + } + this.fetchInfo(id) this.getEvaluationList(id) // 浏览记录 if (S.getAuthToken()) { @@ -194,7 +177,8 @@ export default class Detail extends Component { const curStore = Taro.getStorageSync('curStore') const { userId } = Taro.getStorageSync('userinfo') const infoId = info.distributor_id - const id = APP_PLATFORM === 'standard' ? curStore.isNostores === 1 ? curStore.store_id: curStore.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: "分享给好友" @@ -211,8 +195,9 @@ export default class Detail extends Component { // 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' ? curStore.isNostores === 1 ? curStore.store_id: curStore.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}`, @@ -235,17 +220,18 @@ export default class Detail extends Component { console.log(e) } } - // async checkWhite () { - // const { status } = await api.wx.getWhiteList() - // if(status == true){ - // setTimeout(() => { - // S.login(this, true) - // }, 1000) - // } - // } + async checkWhite () { + const { status } = await api.wx.getWhiteList() + if(status == true){ + setTimeout(() => { + S.login(this, true) + }, 1000) + } + } async fetchInfo(itemId, goodsId) { - const { distributor_id,isNostores,store_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 @@ -256,11 +242,10 @@ export default class Detail extends Component { const param = { goods_id: goodsId } if (APP_PLATFORM === 'standard') { - param.distributor_id = isNostores == 1 ? store_id : distributor_id  + param.distributor_id = is_open_store_status ? store_id : distributor_id  } else { - param.distributor_id  = this.$router.params.dtid + param.distributor_id = is_open_store_status ? store_id : this.$router.params.dtid } - // 商品详情 const info = await api.item.detail(id, param) // 是否订阅 @@ -469,12 +454,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 = curStore.isNostores === 1 ? curStore.store_id : 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}` @@ -539,14 +524,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,isNostores,store_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' ? isNostores === 1 ? store_id : 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}) @@ -742,7 +727,8 @@ export default class Detail extends Component { handleClickItem = (item) => { const curStore = Taro.getStorageSync('curStore') - const id = APP_PLATFORM === 'standard' ? curStore.isNostores === 1 ? curStore.store_id :curStore.distributor_id : item.distributor_id + 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 @@ -751,10 +737,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,isNostores,store_id } = Taro.getStorageSync('curStore') - id = isNostores === 1 ? store_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 @@ -866,6 +853,8 @@ export default class Detail extends Component { new_coupon_list = coupon_list.list.slice(0, 3) } + + console.log('info---->',info) return ( Date: Fri, 27 Nov 2020 11:54:38 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=E9=9D=9E=E8=87=AA=E6=8F=90=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/espier-checkout.js | 3 +-- src/pages/store/list.js | 12 +++--------- src/pages/store/ziti-list.js | 28 +++++++++++----------------- src/utils/entry.js | 1 - 4 files changed, 15 insertions(+), 29 deletions(-) diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 34253a762..6d9763d08 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -314,7 +314,7 @@ export default class CartCheckout extends Component { } } const shopInfo = await api.shop.getShop(ztparams); - Taro.setStorageSync('ztStore',shopInfo) + isOpenStore && Taro.setStorageSync('ztStore',shopInfo) this.setState({ curStore: shopInfo, receiptType: zitiShop ? 'ziti' : shopInfo.is_delivery ? "logistics" : "ziti", @@ -746,7 +746,6 @@ export default class CartCheckout extends Component { handleSwitchExpress = key => { const receiptType = JSON.parse(key) ? "logistics" : "ziti"; - const { curStore } = Taro.getStorageSync('curStore') this.clearPoint(); this.setState( { diff --git a/src/pages/store/list.js b/src/pages/store/list.js index 66a72ba8e..20253373a 100644 --- a/src/pages/store/list.js +++ b/src/pages/store/list.js @@ -54,15 +54,6 @@ export default class StoreList extends Component { pageSize } const { list, total_count: total} = await api.shop.list(query) - const isOpenStore = await entry.getStoreStatus() - list.map(item=>{ - if(isOpenStore){ - item.store_id = 0 - item.isNostores = 1 - }else{ - item.isNostores = 0 - } - }) this.setState({ list: [...this.state.list, ...list], query @@ -152,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() } diff --git a/src/pages/store/ziti-list.js b/src/pages/store/ziti-list.js index 752b8a017..1a16d63a5 100644 --- a/src/pages/store/ziti-list.js +++ b/src/pages/store/ziti-list.js @@ -31,7 +31,6 @@ export default class StoreZitiList extends Component { multiIndex:[], areaList: [], info: {}, - currCityinfo:{} } } config = { @@ -43,7 +42,6 @@ export default class StoreZitiList extends Component { const cityInfo = Taro.getStorageSync('ztStore') let query = {} if (lnglat) { - const { latitude, longitude } = lnglat query = { lat: lnglat.latitude, lng: lnglat.longitude @@ -59,14 +57,15 @@ export default class StoreZitiList extends Component { const store = Taro.getStorageSync('curStore') if (store) { this.setState({ - current: store, query, - currCityinfo:cityInfo ? cityInfo : {} + current:cityInfo ? cityInfo : store }, () => { this.nextPage() }) + }else{ + this.handleGetLocation() } - //this.handleGetLocation() + } @@ -74,8 +73,7 @@ export default class StoreZitiList extends Component { const isOpenStore = await entry.getStoreStatus() const cityInfo = Taro.getStorageSync('cityInfo') const { page_no: page, page_size: pageSize } = params - const { selectParams, areaList, tagsList, curTagId } = this.state - const { shop_id,order_type, cart_type,seckill_id,ticket,goodType} = this.$router.params + const { shop_id,order_type, cart_type,seckill_id,ticket} = this.$router.params const query = { ...this.state.query, page, @@ -85,7 +83,6 @@ export default class StoreZitiList extends Component { seckill_id, seckill_ticket:ticket, isNostores:isOpenStore ? 1 : 0, - iscrossborder:goodType ==='cross' ? 1 : '' } const { list, total_count: total} = await api.shop.list(query) @@ -105,7 +102,6 @@ export default class StoreZitiList extends Component { distance_show:'distance_show', distance_unit:'distance_unit', store_id:isOpenStore ? '' : 0, - isNostores:isOpenStore ? 1 : 0 }) let res = await api.member.areaList() const nAreaList = pickBy(res, { @@ -134,7 +130,6 @@ export default class StoreZitiList extends Component { query, is_open_store_status:isOpenStore, areaList: [arrProvice, arrCity, arrCounty], - //info:cityInfo ? cityInfo : {} }) return { @@ -203,7 +198,6 @@ export default class StoreZitiList extends Component { Taro.removeStorageSync('lnglat') const store = await entry.getLocal(true) if (store) { - // Taro.setStorageSync('curStore', store) this.resetPage() this.setState({ list: [], @@ -270,7 +264,6 @@ handleClickPicker = () => { } bindMultiPickerChange = async (e) => { - console.log('bindMultiPickerChange') const { info,query } = this.state this.nAreaList.map((item, index) => { if(index === e.detail.value[0]) { @@ -288,8 +281,8 @@ bindMultiPickerChange = async (e) => { } }) const { province, city,county } = info - delete query.lat - delete query.lng + // delete query.lat + // delete query.lng this.setState({ query: { ...this.state.query, @@ -375,7 +368,7 @@ bindMultiPickerColumnChange = (e) => { } render () { - const { list, scrollTop, showBackToTop, loading, current, query,is_open_store_status,areaList,multiIndex,page,info,currCityinfo } = this.state + const { list, scrollTop, showBackToTop, loading, current, query,is_open_store_status,areaList,multiIndex,page,info } = this.state return ( { loading ? 定位中... : + { info && info.province ? {info.province}{info.city}{info.county} - : currCityinfo - ? {currCityinfo.regions[0]}{currCityinfo.regions[1]}{currCityinfo.regions[2]} + : current + ? {current.regions[0]}{current.regions[1]}{current.regions[2]} :'定位失败' } diff --git a/src/utils/entry.js b/src/utils/entry.js index 47f5bfe78..69b3ed2db 100644 --- a/src/utils/entry.js +++ b/src/utils/entry.js @@ -87,7 +87,6 @@ async function getLocalSetting() { // } // Taro.setStorageSync('curStore', store) async function getLocal (isNeedLocate) { - //const isOpenStore = await getStoreStatus() let store = null const positionStatus = await getLocalSetting() if (!positionStatus) { From bc0796bb78c84b41415fb414d9b5806d58a18ce5 Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Fri, 27 Nov 2020 14:29:14 +0800 Subject: [PATCH 16/21] =?UTF-8?q?=E9=9D=9E=E9=97=A8=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/goods-buy-panel/index.js | 4 +-- src/pages/cart/espier-checkout.js | 37 +++++++++++++------------ src/pages/home/wgts/goods-grid.js | 1 - src/pages/item/espier-detail.js | 10 +++++-- src/pages/store/ziti-list.js | 22 +++++++-------- 5 files changed, 40 insertions(+), 34 deletions(-) diff --git a/src/components/goods-buy-panel/index.js b/src/components/goods-buy-panel/index.js index 2457b726a..531660f99 100644 --- a/src/components/goods-buy-panel/index.js +++ b/src/components/goods-buy-panel/index.js @@ -274,13 +274,13 @@ export default class GoodsBuyPanel extends Component { console.warn(this.props); if (this.state.busy) return; - const { marketing, info } = this.props; + const { marketing, info,isOpenStores } = 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 = curStore.isNostores === 1 ? curStore.store_id: curStore.distributor_id + let id = isOpenStores ? curStore.store_id: curStore.distributor_id let url = `/pages/cart/espier-checkout`; this.setState({ diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 6d9763d08..2233e9801 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -154,10 +154,6 @@ export default class CartCheckout extends Component { return; } - const isOpenStore = await entry.getStoreStatus() - this.setState({ - isOpenStore - }) const { cart_type, pay_type: payType, shop_id } = this.$router.params; let curStore = null, info = null; @@ -230,7 +226,7 @@ export default class CartCheckout extends Component { // this.handleAddressChange(this.props.defaultAddress) this.props.onAddressChoose(null); this.props.onChangeZitiStore(null); - Taro.removeStorageSync('cityInfo') + Taro.removeStorageSync('selectShop') this.getSalespersonNologin(); // this.getShop() this.fetchAddress(); @@ -250,6 +246,7 @@ export default class CartCheckout extends Component { // teardown clean this.props.onClearCoupon(); this.props.onClearDrugInfo(); + Taro.removeStorageSync('selectShop') } componentDidShow() { @@ -270,27 +267,33 @@ export default class CartCheckout extends Component { } async fetchZiTiShop() { - const { shop_id, scene,cart_type,seckill_id = null,ticket = null} = this.$router.params; - const { zitiShop } = this.props; + 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 { isOpenStore} = this.state + const selectShop = Taro.getStorageSync('selectShop') let id = shop_id; let ztparams ={} if (scene) { const { dtid } = normalizeQuerys(this.$router.params); id = dtid; } + const isOpenStore = await entry.getStoreStatus() + this.setState({ + isOpenStore + }) if(isOpenStore) {//是否开启非门店自提 + console.log('111111') ztparams = { sNostores: 1,//1 开启 order_type : params.order_type, + cart_type, seckill_id: seckill_id, - seckill_ticket: ticket + seckill_ticket: ticket, } - if(zitiShop){ + if(selectShop){ ztparams = { ...ztparams, - distributor_id:zitiShop.distributor_id, + distributor_id:selectShop.distributor_id, } }else { @@ -306,21 +309,22 @@ export default class CartCheckout extends Component { ztparams ={ isNostores: 0//0 未开启 } - if(!zitiShop){ + if(!selectShop){ ztparams ={ ...ztparams, distributor_id: id } } } + //console.log('zitiShop---->',zitiShop) const shopInfo = await api.shop.getShop(ztparams); - isOpenStore && Taro.setStorageSync('ztStore',shopInfo) + Taro.setStorageSync('selectShop',shopInfo) this.setState({ curStore: shopInfo, - receiptType: zitiShop ? 'ziti' : shopInfo.is_delivery ? "logistics" : "ziti", - express: zitiShop ? false : shopInfo.is_delivery ? true : false, + receiptType: selectShop ? 'ziti' : shopInfo.is_delivery ? "logistics" : "ziti", + express: selectShop ? false : shopInfo.is_delivery ? true : false, },()=>{ - isOpenStore && this.calcOrder() + this.calcOrder() }); } @@ -1452,7 +1456,6 @@ export default class CartCheckout extends Component { // const { curStore } = this.state const { type, goodType, bargain_id } = this.$router.params; const isDrug = type === "drug"; - console.log('isOpenStore---->',isOpenStore) if (!info) { return ; diff --git a/src/pages/home/wgts/goods-grid.js b/src/pages/home/wgts/goods-grid.js index e685f488e..face057d0 100644 --- a/src/pages/home/wgts/goods-grid.js +++ b/src/pages/home/wgts/goods-grid.js @@ -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({ diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index 6c9c2db16..930585b1b 100644 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -84,8 +84,10 @@ export default class Detail extends Component { const { is_open_store_status } = this.state // const { distributor_id } = Taro.getStorageSync('curStore') const curStore = Taro.getStorageSync('curStore') - if (!options.dtid || options.dtid !== 0) { - options.dtid = is_open_store_status ? '': curStore.distributor_id + if(!is_open_store_status){ + if (!options.dtid || options.dtid !== 0) { + options.dtid = curStore.distributor_id + } } const entryData = await entry.entryLaunch(options, true) id = entryData.id @@ -817,7 +819,8 @@ export default class Detail extends Component { page, evaluationTotal, evaluationList, - isSubscribeGoods + isSubscribeGoods, + is_open_store_status } = this.state const { showLikeList, colors } = this.props @@ -1326,6 +1329,7 @@ export default class Detail extends Component { type={buyPanelType} marketing={marketing} isOpened={showBuyPanel} + isOpenStores={is_open_store_status} onClose={() => this.setState({ showBuyPanel: false })} fastBuyText={marketing === "group" ? "我要开团" : "立即购买"} onChange={this.handleSkuChange} diff --git a/src/pages/store/ziti-list.js b/src/pages/store/ziti-list.js index 1a16d63a5..06150e567 100644 --- a/src/pages/store/ziti-list.js +++ b/src/pages/store/ziti-list.js @@ -39,19 +39,21 @@ export default class StoreZitiList extends Component { componentDidMount () { const lnglat = Taro.getStorageSync('lnglat') - const cityInfo = Taro.getStorageSync('ztStore') + const cityInfo = Taro.getStorageSync('selectShop') let query = {} - if (lnglat) { - query = { - lat: lnglat.latitude, - lng: lnglat.longitude - } - } + // 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.county, + area:cityInfo.area, } } const store = Taro.getStorageSync('curStore') @@ -65,13 +67,10 @@ export default class StoreZitiList extends Component { }else{ this.handleGetLocation() } - } - async fetch (params) { const isOpenStore = await entry.getStoreStatus() - const cityInfo = Taro.getStorageSync('cityInfo') const { page_no: page, page_size: pageSize } = params const { shop_id,order_type, cart_type,seckill_id,ticket} = this.$router.params const query = { @@ -361,6 +360,7 @@ bindMultiPickerColumnChange = (e) => { return } this.props.onChangeZitiStore(selected[0]) + Taro.setStorageSync('selectShop',selected[0]) setTimeout(() => { Taro.navigateBack() }, 300) From dafc5142e2c800374d593d0916eae3f8f15d58d9 Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Fri, 27 Nov 2020 14:50:39 +0800 Subject: [PATCH 17/21] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/espier-checkout.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 2233e9801..06e9083b8 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -316,15 +316,14 @@ export default class CartCheckout extends Component { } } } - //console.log('zitiShop---->',zitiShop) const shopInfo = await api.shop.getShop(ztparams); - Taro.setStorageSync('selectShop',shopInfo) + isOpenStore && Taro.setStorageSync('selectShop',shopInfo) this.setState({ curStore: shopInfo, receiptType: selectShop ? 'ziti' : shopInfo.is_delivery ? "logistics" : "ziti", express: selectShop ? false : shopInfo.is_delivery ? true : false, },()=>{ - this.calcOrder() + isOpenStore && this.calcOrder() }); } @@ -1004,7 +1003,6 @@ export default class CartCheckout extends Component { // } const { payType, total, identity,isOpenStore,curStore } = 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"; @@ -1049,8 +1047,8 @@ 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 = isOpenStore ? curStore.distributor_id : this.getShopId() || distributor_id; + const { distributor_id,store_id } = Taro.getStorageSync("curStore"); + params.distributor_id = isOpenStore ? store_id : this.getShopId() || distributor_id; } From 0c676a2e77e45a8a236b0d2b4ab9a79f078b93fc Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Fri, 27 Nov 2020 15:09:57 +0800 Subject: [PATCH 18/21] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/espier-checkout.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/cart/espier-checkout.js b/src/pages/cart/espier-checkout.js index 06e9083b8..23b8383e8 100644 --- a/src/pages/cart/espier-checkout.js +++ b/src/pages/cart/espier-checkout.js @@ -284,7 +284,7 @@ export default class CartCheckout extends Component { if(isOpenStore) {//是否开启非门店自提 console.log('111111') ztparams = { - sNostores: 1,//1 开启 + isNostores: 1,//1 开启 order_type : params.order_type, cart_type, seckill_id: seckill_id, @@ -1001,7 +1001,7 @@ export default class CartCheckout extends Component { // if (!this.state.address) { // return S.toast('请选择地址') // } - const { payType, total, identity,isOpenStore,curStore } = 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 @@ -1048,10 +1048,9 @@ export default class CartCheckout extends Component { let params = this.getParams(); if (APP_PLATFORM === "standard" && cart_type !== "cart") { const { distributor_id,store_id } = Taro.getStorageSync("curStore"); - params.distributor_id = isOpenStore ? store_id : this.getShopId() || distributor_id; + params.distributor_id = isOpenStore ? receiptType === 'ziti' ? curStore.distributor_id : store_id : this.getShopId() || distributor_id; } - delete params.items; // 积分不开票 if (payType === "point") { @@ -1064,6 +1063,7 @@ export default class CartCheckout extends Component { if (salesman_id) { params.salesman_id = salesman_id; } + // 如果是跨境商品 if (goodType === "cross") { From b08024469feabf2a1a2d9e6d39ee461d03eef707 Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Fri, 27 Nov 2020 15:42:04 +0800 Subject: [PATCH 19/21] =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/goods-buy-panel/index.js | 7 ++++--- src/pages/item/espier-detail.js | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/goods-buy-panel/index.js b/src/components/goods-buy-panel/index.js index 531660f99..bef9ad348 100644 --- a/src/components/goods-buy-panel/index.js +++ b/src/components/goods-buy-panel/index.js @@ -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,14 +274,14 @@ export default class GoodsBuyPanel extends Component { handleBuyClick = async (type, skuInfo, num) => { console.warn(this.props); if (this.state.busy) return; - - const { marketing, info,isOpenStores } = this.props; + 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 = isOpenStores ? curStore.store_id: curStore.distributor_id + let id = isOpenStore ? curStore.store_id: curStore.distributor_id let url = `/pages/cart/espier-checkout`; this.setState({ diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index 930585b1b..7ed437089 100644 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -1329,7 +1329,6 @@ export default class Detail extends Component { type={buyPanelType} marketing={marketing} isOpened={showBuyPanel} - isOpenStores={is_open_store_status} onClose={() => this.setState({ showBuyPanel: false })} fastBuyText={marketing === "group" ? "我要开团" : "立即购买"} onChange={this.handleSkuChange} From 19ebc39c3cd99d821266363c04a26205d79fbba7 Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Fri, 27 Nov 2020 16:17:12 +0800 Subject: [PATCH 20/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6/=E7=AB=8B=E5=8D=B3=E8=B4=AD?= =?UTF-8?q?=E4=B9=B0=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/goods-buy-panel/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/goods-buy-panel/index.js b/src/components/goods-buy-panel/index.js index bef9ad348..fd7ad67a5 100644 --- a/src/components/goods-buy-panel/index.js +++ b/src/components/goods-buy-panel/index.js @@ -281,7 +281,8 @@ export default class GoodsBuyPanel extends Component { 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: curStore.distributor_id + let id = isOpenStore ? curStore.store_id : distributor_id let url = `/pages/cart/espier-checkout`; this.setState({ @@ -295,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({ From 3730bf87a6532a7aaccb836f5c80fb213075bf35 Mon Sep 17 00:00:00 2001 From: "[wangtengteng]" <[wangtengteng@shopex.cn]> Date: Fri, 27 Nov 2020 17:02:23 +0800 Subject: [PATCH 21/21] =?UTF-8?q?=E9=9D=9E=E9=97=A8=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/item/espier-detail.js | 4 +++- src/utils/entry.js | 8 -------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index 7ed437089..6f9306e2f 100644 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -84,10 +84,12 @@ export default class Detail extends Component { const { is_open_store_status } = this.state // const { distributor_id } = Taro.getStorageSync('curStore') const curStore = Taro.getStorageSync('curStore') - if(!is_open_store_status){ + 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 diff --git a/src/utils/entry.js b/src/utils/entry.js index 69b3ed2db..fb2d3c43c 100644 --- a/src/utils/entry.js +++ b/src/utils/entry.js @@ -199,14 +199,6 @@ async function handleDistributorId(distributorId) { const res = await api.shop.getShop({distributor_id: distributorId}) //const isOpenStore = await getStoreStatus() if (res.status === false) { - // if(isOpenStore){ //新增逻辑,如果开启了非门店自提流程,新增字段 - // res.store_id=0, //总店distribution_id为0 - // res.isNostores=1 //是否开启,1,代表开启 - // }else{ - // //store.store_id=-1 - // res.isNostores=0 //0 未开启 - // } - // 新增逻辑,如果开启了非门店自提流程,新增字段,开启非门店自提流程,所有的distribution_id 取值为0,store_id res.store_id = 0 Taro.setStorageSync('curStore', res)