main
王文龙 2024-01-19 13:36:57 +08:00
commit 5a852daca0
1680 changed files with 231960 additions and 0 deletions

12
.editorconfig Executable file
View File

@ -0,0 +1,12 @@
# https://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

16
.env Executable file
View File

@ -0,0 +1,16 @@
APP_BASE_URL=
APP_WEBSOCKET=
APP_COMPANY_ID=
APP_PLATFORM=
APP_CUSTOM_SERVER=
APP_HOME_PAGE=
APP_TRACK=youshu
APP_YOUSHU_TOKEN=bi281e87ab2424481a
APP_ID=
APP_MAP_KEY=
APP_MAP_NAME=
APP_IMAGE_CDN=
APP_DIANWU_URL=
APP_MERCHANT_URL=
APP_ADAPAY=

15
.env.development Executable file
View File

@ -0,0 +1,15 @@
APP_BASE_URL=http://47.103.169.154:8080/api/h5app/wxapp
APP_WEBSOCKET=wss://http://47.103.169.154:8080/ws
APP_COMPANY_ID=1
APP_PLATFORM=standard
APP_CUSTOM_SERVER=http://47.103.169.154:8081/
APP_HOME_PAGE=/pages/index
APP_TRACK=youshu
APP_YOUSHU_TOKEN=bi281e87ab2424481a
# APP_ID=wx3e1c17c88abf3e45
APP_ID=wx55ff808ba0e28b1d
APP_MAP_KEY=1ccc1ebc947719886f0cd766d70241fe
APP_MAP_NAME=oneX新零售门店定位
APP_IMAGE_CDN=https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
APP_IMAGE_CDN_NEW=https://espier-oss-cdn.oss-cn-shanghai.aliyuncs.com/default_project/wxAssets
APP_DIANWU_URL=

14
.env.example Executable file
View File

@ -0,0 +1,14 @@
APP_BASE_URL=https://ecshopx1.shopex123.com/api/h5app/wxapp
APP_WEBSOCKET=wss://ecshopx1.shopex123.com/ws
APP_COMPANY_ID=1
APP_PLATFORM=standard
APP_CUSTOM_SERVER=https://ecshopx-h5.ex-sandbox.com/
APP_HOME_PAGE=/pages/index
APP_TRACK=youshu
APP_YOUSHU_TOKEN=bi281e87ab2424481a
# APP_ID=wx3e1c17c88abf3e45
APP_ID=wx55ff808ba0e28b1d
APP_MAP_KEY=1ccc1ebc947719886f0cd766d70241fe
APP_MAP_NAME=oneX新零售门店定位
APP_IMAGE_CDN=https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
APP_DIANWU_URL=

15
.env.production Executable file
View File

@ -0,0 +1,15 @@
APP_BASE_URL=http://47.103.169.154:8080/api/h5app/wxapp
APP_WEBSOCKET=wss://http://47.103.169.154:8080/ws
APP_COMPANY_ID=1
APP_PLATFORM=standard
APP_CUSTOM_SERVER=http://47.103.169.154:8081/
APP_HOME_PAGE=/pages/index
APP_TRACK=youshu
APP_YOUSHU_TOKEN=bi281e87ab2424481a
# APP_ID=wx3e1c17c88abf3e45
APP_ID=wx55ff808ba0e28b1d
APP_MAP_KEY=1ccc1ebc947719886f0cd766d70241fe
APP_MAP_NAME=oneX新零售门店定位
APP_IMAGE_CDN=https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
APP_IMAGE_CDN_NEW=https://espier-oss-cdn.oss-cn-shanghai.aliyuncs.com/default_project/wxAssets
APP_DIANWU_URL=

7
.env.uat Executable file
View File

@ -0,0 +1,7 @@
APP_PUBLIC_PATH=https://d9lg74id8h8so.cloudfront.net
APP_CDN=aws
APP_CDN_PATH=ecshopx-vshop/
APP_CDN_KEY=AKIASILBYII236LRO6AB
APP_CDN_SCERET=dar3rfReYgMVWRQKAmg91y8tF/xLLPySfbZe66Qv
APP_CDN_REGION=ap-southeast-2
APP_CDN_BUCKET=unat-bucket

16
.eslintrc.js Executable file
View File

@ -0,0 +1,16 @@
module.exports = {
extends: ["taro"],
rules: {
"no-unused-vars": ["error", { varsIgnorePattern: "Taro" }],
// "space-before-function-paren": [1, "always"],
"import/no-named-as-default": 0,
"react/react-in-jsx-scope": 0
},
parser: "babel-eslint",
globals: {
TARO_APP: false,
wx: false
}
};

14
.gitignore vendored Executable file
View File

@ -0,0 +1,14 @@
.temp/
.rn_temp/
node_modules/
.DS_Store
.idea/
.h5_dev_dist
release.*
dist_iwa.zip
sitemap.json
dist/
.app_modules.*
.husky
.history
.swc

11
.prettierrc Executable file
View File

@ -0,0 +1,11 @@
{
"trailingComma": "none",
"semi": false,
"singleQuote": true,
"jsxSingleQuote": true,
"arrowParens": "always",
"printWidth": 100,
"tabWidth": 2,
"quoteProps": "preserve",
"endOfLine": "auto"
}

6
.vscode/setting.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"search.exclude": {
"package-lock.json": true,
"node_modules": true
}
}

2170
CHANGELOG.md Executable file

File diff suppressed because it is too large Load Diff

48
Dockerfile Executable file
View File

@ -0,0 +1,48 @@
FROM node:12.19.1-alpine3.12 AS builder
ARG CMD
ARG APP_BASE_URL
ARG APP_WEBSOCKET
ARG APP_COMPANY_ID
ARG APP_PLATFORM
ARG APP_CUSTOM_SERVER
ARG APP_HOME_PAGE
ARG APP_TRACK
ARG APP_YOUSHU_TOKEN
ARG APP_ID
ARG APP_MAP_KEY
ARG APP_MAP_NAME
ARG APP_VUE_SAAS
ARG APP_DIANWU_URL
ARG APP_MERCHANT_URL
ENV APP_BASE_URL ${APP_BASE_URL}
ENV APP_WEBSOCKET ${APP_WEBSOCKET}
ENV APP_COMPANY_ID ${APP_COMPANY_ID}
ENV APP_PLATFORM ${APP_PLATFORM}
ENV APP_CUSTOM_SERVER ${APP_CUSTOM_SERVER}
ENV APP_HOME_PAGE ${APP_HOME_PAGE}
ENV APP_TRACK ${APP_TRACK}
ENV APP_YOUSHU_TOKEN ${APP_YOUSHU_TOKEN}
ENV APP_ID ${APP_ID}
ENV APP_MAP_KEY ${APP_MAP_KEY}
ENV APP_MAP_NAME ${APP_MAP_NAME}
ENV APP_VUE_SAAS ${APP_VUE_SAAS}
ENV APP_DIANWU_URL ${APP_DIANWU_URL}
ENV APP_MERCHANT_URL ${APP_MERCHANT_URL}
WORKDIR /app
COPY package*.json ./
COPY .env ./
RUN npm config set registry https://registry.npm.taobao.org && npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ && npm config set @shopex:registry http://registry.npm.ishopex.cn && npm ci
COPY . .
RUN ls -la
RUN ${CMD}
RUN ls -l /app/dist/h5
FROM steebchen/nginx-spa:stable
WORKDIR /app
COPY --from=builder /app/dist/h5 .
EXPOSE 80
CMD ["nginx"]

70
README.md Executable file
View File

@ -0,0 +1,70 @@
# 说明文档
## .env文件配置信息
```json
{
"APP_BASE_URL": "接口访问地址",
"APP_WEBSOCKET": "websocket访问地址",
"APP_COMPANY_ID": "企业id",
"APP_PLATFORM": "打包平台standard为标准版, platform为平台版",
"APP_CUSTOM_SERVER": "域名地址H5支付回调使用",
"APP_HOME_PAGE": "首页访问路径",
"APP_MAP_KEY": "H5 腾讯地图使用key",
"APP_MAP_NAME": "H5 使用地图name"
}
```
## npm打包指令
```bash
#小程序本地开发编译
npm run dev:weapp
#小程序生产打包
npm run build:weapp
#H5本地开发编译
npm run dev:h5
#H5生产打包
npm run build:h5
```
## 注意事项
- 关于小程序预览dev:weapp本地开发编译模式下因为主包过大无法上传预览需要使用build:weapp打包后选择小程序开发工具中的详情->本地设置->上传代码时自动压缩混淆
## shell脚本指令使用
- dev.sh和run.sh脚本命令使用,conpanys.conf文件为设置env.json文件的配置信息新增配置需同已有配置格式保持一致,打包完成后需手动更改appid
```bash
#开发模式使用
sh dev.sh
#打包使用
sh run.sh
```
cicd test 3
## 代码prettier
npm run prepare
npx husky add .husky/pre-commit "npx lint-staged --allow-empty"
## 如果用ASW打包上传cdn需要增加以下配置,配置值根据实际情况调整
APP_PUBLIC_PATH=https://CDN域名
APP_CDN=aws
APP_CDN_PATH=ecshopx-vshop/
APP_CDN_KEY=
APP_CDN_SCERET=
APP_CDN_REGION=ap-southeast-2
APP_CDN_BUCKET=unat-bucket
# 如遇初始化下载时间过长或者network timeout可更换npm镜像源
# npm更换淘宝镜像使用此命令后npm指令关键词改为cnpm例如npm i 改为 cnpm i
# 更换命令npm install -g cnpm --registry=https://registry.npm.taobao.org
# 先安装插件
npm install @shopex/taro-plugin-modules -S --registry=http://registry.npm.ishopex.cn
# 再安装其他依赖
npm install

10
babel.config.js Executable file
View File

@ -0,0 +1,10 @@
// Learn more about babel-preset-taro here:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = {
presets: [
['taro', {
framework: 'react',
ts: true
}]
]
};

11
companys.conf Normal file
View File

@ -0,0 +1,11 @@
appid = wxf7abee400d50e0d0
base_url = http://47.103.169.154:8080/api/h5app/wxapp
websocket = wss://http://47.103.169.154:8080/ws
company_id = 1
app_name = BIRKENSTOCK
platform = platform
custom_server = http://47.103.169.154:8081/
home_page = /pages/index
map_key = 1ccc1ebc947719886f0cd766d70241fe
map_name = oneX新零售门店定位
image_cdn = https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop

9
config/dev.js Executable file
View File

@ -0,0 +1,9 @@
module.exports = {
env: {
NODE_ENV: '"development"'
},
defineConstants: {
},
weapp: {},
h5: {}
}

17
config/host.js Executable file
View File

@ -0,0 +1,17 @@
module.exports = {
h5: {
prod: 'ecshopx.shopex123.com/index.php',
preissue: 'ecshopx.shopex123.com/index.php',
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'
},
websocket: {
development: 'wss://ecshopx.shopex123.com/ws',
production: 'wss://b-websocket.yuanyuanke.cn',
preissue: 'wss://preissue-b-websocket.yuanyuanke.cn'
}
}

180
config/index.js Normal file
View File

@ -0,0 +1,180 @@
import path from 'path'
import pkg from '../package.json'
const chalk = require("chalk")
const { getEnvs, getDefineConstants, getCacheIdentifier } = require('./utils')
require('dotenv-flow').config()
const DIST_PATH = `dist/${process.env.TARO_ENV}`
const APP_ENVS = getEnvs()
// 是否为生产模式
const IS_PROD = process.env.NODE_ENV === 'production'
const BUILD_TARGET = process.env.TARGET
const BUILD_APP_SERVER = process.env.SERVER
const CONST_ENVS = {
APP_NAME: pkg.app_name,
APP_AUTH_PAGE:
process.env.TARO_ENV == 'h5' ? '/subpage/pages/auth/login' : '/subpages/member/index',
APP_BUILD_TARGET: BUILD_TARGET,
APP_LIVE: process.env.APP_LIVE,
...APP_ENVS
}
Object.keys(CONST_ENVS).forEach(key => {
console.log(chalk.green(`${key}=${CONST_ENVS[key]}`))
})
// 是否打包APP
const IS_APP = BUILD_TARGET === 'app'
// 是否打包成APP服务
const IS_APP_SERVER = BUILD_APP_SERVER === 'server'
const copyPatterns = [{ from: 'src/assets', to: `${DIST_PATH}/assets` }]
if (process.env.TARO_ENV == 'weapp') {
copyPatterns.push({ from: 'src/ext.json', to: `${DIST_PATH}/ext.json` })
}
if (process.env.TARO_ENV == 'h5') {
copyPatterns.push({ from: 'src/files', to: `${DIST_PATH}` })
}
if (process.env.TARO_ENV == 'alipay') {
copyPatterns.push({ from: 'mini.project.json', to: `${DIST_PATH}/mini.project.json` })
}
const config = {
projectName: pkg.name,
date: '2021-11-22',
framework: 'react',
designWidth: 750,
deviceRatio: {
'640': 2.34 / 2,
'750': 1,
'828': 1.81 / 2
},
sourceRoot: 'src',
outputRoot: DIST_PATH,
sass: {
resource: path.resolve(__dirname, '..', 'src/style/imports.scss'),
projectDirectory: path.resolve(__dirname, '..')
},
defineConstants: getDefineConstants(CONST_ENVS),
alias: {
'taro-ui$': 'taro-ui/lib/index',
'@': path.join(__dirname, '../src'),
'lodash': 'lodash-es'
},
copy: {
patterns: copyPatterns
},
plugins: [
// 'taro-plugin-compiler-optimization'
// '@shopex/taro-plugin-modules',
// path.join(__dirname, "../src/plugin/test.js")
// path.join(__dirname, "./modify-taro.js")
],
mini: {
// webpackChain (chain, webpack) {
// // chain.plugin('analyzer')
// // .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
// chain.merge({
// plugin: {
// install: {
// plugin: require('terser-webpack-plugin'),
// args: [
// {
// terserOptions: {
// compress: true, // 默认使用terser压缩
// // mangle: false,
// keep_classnames: true, // 不改变class名称
// keep_fnames: true, // 不改变函数名称
// },
// },
// ],
// },
// },
// })
// },
cache: {
enable: true,
cacheDirectory: 'node_modules/.cache',
cacheIdentifier: getCacheIdentifier(CONST_ENVS)
},
miniCssExtractPluginOption: {
ignoreOrder: true
},
optimizeMainPackage: {
enable: true
},
// 图片转换base64
imageUrlLoaderOption: {
limit: 0
},
postcss: {
autoprefixer: {
enable: true
},
pxtransform: {
enable: true,
config: {}
},
url: {
enable: true,
config: {
limit: 10240 // 设定转换尺寸上限
}
},
cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
},
},
h5: {
// publicPath: IS_PROD ? './' : '/',
// publicPath: '/',
publicPath: (IS_APP && IS_PROD && !IS_APP_SERVER) ? './' : '/',
// publicPath: process.env.APP_PUBLIC_PATH || '/',
staticDirectory: 'static',
router: {
mode: IS_APP ? "hash" : "browser"
// mode: "browser"
},
devServer: {
// https: true,
// overlay: {
// warnings: false,
// errors: false
// }
// https: {
// key: "../cert/ecshopx-server.key",
// cert: "../cert/ecshopx-server.crt",
// // passphrase: "webpack-dev-server",
// requestCert: true
// }
},
postcss: {
autoprefixer: {
enable: true,
config: {
overrideBrowserslist: ['last 3 versions', 'Android >= 4.1', 'ios >= 8']
}
}
},
esnextModules: ['taro-ui']
}
}
module.exports = function (merge) {
if (!IS_PROD) {
return merge({}, config, require('./dev'))
}
return merge({}, config, require('./prod'))
}

29
config/modify-taro.js Executable file
View File

@ -0,0 +1,29 @@
const ConcatSource = require("webpack-sources").ConcatSource;
export default ctx => {
ctx.modifyBuildAssets(build => {
// BA首页workaround
const taroJs = build.assets["taro.js"];
if (taroJs) {
const source = taroJs.source();
let newSource;
if (process.env.NODE_ENV === "production") {
newSource = source.replace(
/(\.eventSplitter=\/\\s\+\/;)/,
"$1_wrapNativeSuper(Array);"
);
newSource = newSource.replace(
/(throw new Error\(\"Unable to resolve global \`this\`\"\))/,
"if(global)return global;$1"
);
} else {
newSource = source.replace(
"var RefsArray",
"_wrapNativeSuper(Array);\nvar RefsArray"
);
}
build.assets["taro.js"] = new ConcatSource(newSource);
}
});
};

81
config/prod.js Executable file
View File

@ -0,0 +1,81 @@
/* eslint-disable import/no-commonjs */
const path = require('path')
module.exports = {
env: {
NODE_ENV: '"production"'
},
h5: process.env.APP_CDN
? {
output: {
filename: 'js/[name].[hash:8].js',
chunkFilename: 'js/[name].[chunkhash:8].js'
},
miniCssExtractPluginOption: {
filename: 'css/[name].[hash:8].css',
chunkFilename: 'css/[id].[hash:8].css'
},
webpackChain(chain) {
// const pkg = require(path.resolve(__dirname, '../package.json'))
// const { publicPath, bucket: CDNBucket, path: CDNPath } = pkg.cdn
const publicPath = process.env.APP_PUBLIC_PATH
const CDNPath = process.env.APP_CDN_PATH
let plugin = {}
if (process.env.APP_CDN == 'aws') {
plugin = {
'asw-s3': {
plugin: require('webpack-s3-plugin'),
args: [
{
exclude: /.*\.html$/,
s3Options: {
accessKeyId: process.env.APP_CDN_KEY,
secretAccessKey: process.env.APP_CDN_SCERET,
region: process.env.APP_CDN_REGION,
ACL: ''
},
s3UploadOptions: {
Bucket: process.env.APP_CDN_BUCKET
},
basePath: CDNPath
// cdnizerOptions: {
// defaultCDNBase: 'http://asdf.ca'
// }
}
]
}
}
}
chain.output
.publicPath(`${publicPath}/${CDNPath}/`)
chain.merge({
plugin
// plugin: {
// 'qn-webpack': {
// plugin: require('qn-webpack'),
// args: [{
// accessKey: process.env.CDN_ACCESS_KEY,
// secretKey: process.env.CDN_SECRET_KEY,
// bucket: CDNBucket,
// path: CDNPath,
// exclude: /(?:manifest\.json|\.map)$/
// }]
// }
// }
})
}
}
: {
output: {
filename: 'js/[name].[hash:8].js',
chunkFilename: 'js/[name].[chunkhash:8].js'
},
miniCssExtractPluginOption: {
filename: 'css/[name].[hash:8].css',
chunkFilename: 'css/[id].[hash:8].css'
}
}
}

41
config/utils.js Executable file
View File

@ -0,0 +1,41 @@
const crypto = require('crypto')
const chalk = require("chalk")
const pkg = require('../package.json')
function digest (str) {
return crypto
.createHash('md5')
.update(str)
.digest('hex')
}
module.exports = {
getEnvs () {
const envs = Object.keys(process.env).reduce((ret, key) => {
const val = process.env[key]
if (key.indexOf("APP_") >= 0) {
// console.log(chalk.green(`${key}=${val}`));
ret[key] = val
}
return ret
}, {})
envs.NODE_ENV = process.env.NODE_ENV
envs.TARO_ENV = process.env.TARO_ENV
return envs
},
getDefineConstants (consts) {
consts = Object.keys(consts).reduce((val, k) => {
val[`process.env.${k}`] = `'${consts[k]}'`
return val
}, {})
return consts
},
getCacheIdentifier (consts = {}) {
const env = process.env.NODE_ENV || 'development'
const envHash = digest(JSON.stringify(consts))
return `cache-loader:${pkg.version} ${env} ${envHash}`
}
}

132
dev.sh Executable file
View File

@ -0,0 +1,132 @@
###
# @Author: Arvin
# @GitHub: https://github.com/973749104
# @Blog: https://liuhgxu.com
# @Description: 说明
# @FilePath: /unite-vshop/dev.sh
# @Date: 2020-06-10 10:15:51
# @LastEditors: PrendsMoi
# @LastEditTime: 2021-04-01 16:09:56
###
#/usr/bash
cd $(dirname "$0")
conf="companys.conf"
if [ ! -n "$1" ]
then
if [ ! -f ${conf} ]
then
echo "not find companys.conf"
exit
else
sections=`sed -n '/\[*\]/p' ${conf} |grep -v '^#'|tr -d []`
fi
COLUMNS=1
echo "选择需要发布的客户"
select var in ${sections};
do
if [ ! -n "$var" ]
then
echo "请选择正确的数字"
exit
fi
appid=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^appid/{print $3}')
baseUrl=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^base_url/{print $3}')
appName=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^app_name/{print $3}')
websocket=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^websocket/{print $3}')
company_id=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^company_id/{print $3}')
platform=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^platform/{print $3}')
custom_server=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^custom_server/{print $3}')
home_page=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^home_page/{print $3}')
map_key=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^map_key/{print $3}')
map_name=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^map_name/{print $3}')
image_cdn=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^image_cdn/{print $3}')
break
done
else
appid=${1}
baseUrl=${2}
appName=${3}
websocket=${4}
company_id=${5}
platform=${6}
custom_server=${7}
home_page=${8}
map_key=${9}
map_name=${10}
image_cdn=${11}
fi
# version=$(git describe --tags `git rev-list --tags --max-count=1`)
# desc="微商城小程序"
# 需要被替换的小程序appid在./src/ext.json和 ./project.config.json
# oldAppid="wx912913df9fef6ddd"
# oldAppName="通用小程序"
# if grep -q ${oldAppid} ./src/ext.json
# then
# sed -i "" "s#${oldAppid}#${appid}#g" ./src/ext.json
# sed -i "" "s#${oldAppName}#${appName}#g" ./src/ext.json
# sed -i "" "s#${oldAppid}#${appid}#g" ./project.config.json
# echo "【SUCCESS】替换appid成功"
# else
# echo "【ERROR】待替换的小程序APPID ${oldAppid} 在./src/ext.json 中不存在"
# exit
# fi
echo '{
"extEnable": true,
"extAppid": "'${appid}'",
"ext": {
"company_id": "'${company_id}'",
"appid": "'${appid}'",
"wxa_name": "'${appName}'"
},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "微商城",
"navigationBarTextStyle": "black"
}
}' > ./src/ext.json
echo 'APP_BASE_URL='${baseUrl}'
APP_WEBSOCKET='${websocket}'
APP_COMPANY_ID='${company_id}'
APP_PLATFORM='${platform}'
APP_CUSTOM_SERVER='${custom_server}'
APP_HOME_PAGE='${home_page}'
APP_TRACK=youshu
APP_YOUSHU_TOKEN=bi281e87ab2424481a
APP_ID='${appid}'
APP_MAP_KEY='${map_key}'
APP_MAP_NAME='${map_name}'
APP_IMAGE_CDN='${image_cdn}'
APP_DIANWU_URL='
> ./.env
echo "请选择编译方式"
buildType="WEAPP H5"
select type in $buildType
do
if [ "$type" = 'WEAPP' ];then
if [ "$(uname)" == "Darwin" ]
then
echo "npm run dev:weapp"
npm run dev:weapp
else
echo "npm run dev:weapp:windows"
npm run dev:weapp:windows
fi
else
npm run dev:h5
fi
done

0
extend/tp-home/pages/index.js Executable file
View File

10
jsconfig.json Executable file
View File

@ -0,0 +1,10 @@
{
"exclude": ["node_modules", "dist"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"experimentalDecorators": true
}
}

3
mini.project.json Executable file
View File

@ -0,0 +1,3 @@
{
"enableAppxNg": true
}

27392
package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

104
package.json Executable file
View File

@ -0,0 +1,104 @@
{
"name": "ecshopx-vshop",
"app_name": "ecshopx",
"version": "3.13.20",
"private": true,
"description": "taro app for bbc",
"scripts": {
"clean": "rm -rf node_modules/.cache",
"build:weapp": "taro build --type weapp --trace-warnings",
"build:weapp:live": "APP_LIVE=true taro build --type weapp --trace-warnings",
"build:swan": "taro build --type swan",
"build:alipay": "taro build --type alipay",
"build:tt": "taro build --type tt",
"build:h5": "taro build --type h5",
"build:rn": "taro build --type rn",
"build:app": "TARGET=app taro build --type h5",
"build:app:server": "TARGET=app SERVER=server taro build --type h5",
"dev:weapp": "npm run build:weapp -- --watch",
"dev:weapp:live": "APP_LIVE=true npm run build:weapp -- --watch",
"dev:weapp:modules": "TARO_MODULES=true npm run build:weapp -- --watch",
"dev:weapp:prd": "cross-env BUILD_ENV=prd npm run build:weapp -- --watch",
"dev:swan": "npm run build:swan -- --watch",
"dev:alipay": "npm run build:alipay -- --watch",
"dev:tt": "npm run build:tt -- --watch",
"dev:h5": "cross-env NODE_ENV=development npm run build:h5 -- --watch",
"dev:app": "TARGET=app npm run build:h5 -- --watch",
"dev:rn": "npm run build:rn -- --watch",
"release:h5": "RELEASE=h5 npm run build:h5",
"lint": "prettier-eslint 'src/**/*.{js,jsx}' --write"
},
"author": "",
"license": "MIT",
"browsers": [
"last 3 versions",
"Android >= 4.1",
"ios >= 8"
],
"dependencies": {
"@reduxjs/toolkit": "^1.6.2",
"axios": "^0.19.0",
"azure-storage": "^2.10.3",
"big.js": "^6.1.1",
"cache-loader": "^4.1.0",
"classnames": "^2.2.6",
"copy-to-clipboard": "^3.0.8",
"dayjs": "^1.10.6",
"lodash": "^4.17.11",
"mini-html-parser2": "^0.3.0",
"qiniu-js": "^2.5.4",
"qrcode": "^1.5.0",
"qs": "6.6.0",
"react": "^17.0.2",
"react-dom": "^16.14.0",
"react-native": "^0.66.4",
"react-redux": "^7.2.5",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-persist-weapp-storage": "^1.2.0",
"sr-sdk-wxapp": "^1.3.12",
"stylenames": "^1.1.6",
"taro-plugin-compiler-optimization": "^1.0.4",
"taro-ui": "3.0.0-alpha.3",
"thread-loader": "^4.0.2",
"use-immer": "^0.6.0"
},
"devDependencies": {
"@babel/runtime": "^7.7.7",
"@tarojs/cli": "3.4.3",
"@tarojs/components": "3.4.3",
"@tarojs/mini-runner": "3.4.3",
"@tarojs/react": "3.4.3",
"@tarojs/runtime": "3.4.3",
"@tarojs/taro": "3.4.3",
"@tarojs/webpack-runner": "3.4.3",
"@types/react": "^16.8.5",
"@types/webpack-env": "^1.13.6",
"babel-eslint": "^8.2.3",
"babel-preset-env": "^1.6.1",
"babel-preset-taro": "3.4.3",
"babel-runtime": "^6.26.0",
"chalk": "^4.1.2",
"cross-env": "^5.2.0",
"dotenv-flow": "^3.1.0",
"eslint": "^4.19.1",
"eslint-config-taro": "3.4.3",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-react": "^7.8.2",
"fs-extra": "^8.0.1",
"glob": "^7.1.4",
"lint-staged": "^12.1.5",
"lodash-webpack-plugin": "^0.11.5",
"prettier": "^2.5.1",
"prettier-eslint": "^13.0.0",
"prettier-eslint-cli": "^5.0.1",
"webpack-bundle-analyzer": "^3.8.0",
"webpack-dev-server": "^2.9.7",
"webpack-s3-plugin": "^1.2.0-rc.0"
},
"lint-staged": {
"src/**/*.{js,jsx,scss}": [
"prettier-eslint --write"
]
}
}

66
project.config.json Executable file
View File

@ -0,0 +1,66 @@
{
"miniprogramRoot": "dist/",
"projectname": "ecshopx-vshop",
"description": "weshop for platform",
"appid": "wx55ff808ba0e28b1d",
"setting": {
"urlCheck": false,
"es6": false,
"enhance": false,
"postcss": false,
"preloadBackgroundData": false,
"minified": false,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": false,
"uploadWithSourceMap": false,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"disableUseStrict": false,
"showES6CompileOption": false,
"useCompilerPlugins": false,
"minifyWXML": true,
"ignoreDevUnusedFiles": false,
"ignoreUploadUnusedFiles": false
},
"compileType": "miniprogram",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"plugin": {
"list": []
},
"game": {
"list": []
},
"miniprogram": {
"list": []
}
}
}

135
run.sh Executable file
View File

@ -0,0 +1,135 @@
#/usr/bash
cd $(dirname "$0")
conf="companys.conf"
if [ ! -n "$1" ]
then
if [ ! -f ${conf} ]
then
echo "not find companys.conf"
exit
else
sections=`sed -n '/\[*\]/p' ${conf} |grep -v '^#'|tr -d []`
fi
COLUMNS=1
echo "选择需要发布的客户"
select var in ${sections};
do
if [ ! -n "$var" ]
then
echo "请选择正确的数字"
exit
fi
appid=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^appid/{print $3}')
baseUrl=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^base_url/{print $3}')
appName=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^app_name/{print $3}')
websocket=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^websocket/{print $3}')
company_id=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^company_id/{print $3}')
platform=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^platform/{print $3}')
custom_server=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^custom_server/{print $3}')
home_page=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^home_page/{print $3}')
map_key=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^map_key/{print $3}')
map_name=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^map_name/{print $3}')
image_cdn=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^image_cdn/{print $3}')
ali_isvid=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^ali_isvid/{print $3}')
dianwu_url=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^dianwu_url/{print $3}')
merchant_url=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^merchant_url/{print $3}')
adapay=$(sed -n '/\['$var'\]/,/^$/p' $conf|grep -Ev '\[|\]|^$'|awk '/^adapay/{print $3}')
break
done
else
appid=${1}
baseUrl=${2}
appName=${3}
websocket=${4}
company_id=${5}
platform=${6}
custom_server=${7}
home_page=${8}
map_key=${9}
map_name=${10}
image_cdn=${11}
ali_isvid=${12}
dianwu_url=${13}
merchant_url=${14}
adapay=${15}
fi
# version=$(git describe --tags `git rev-list --tags --max-count=1`)
# desc="微商城小程序"
# 需要被替换的小程序appid在./src/ext.json和 ./project.config.json
# oldAppid="wx912913df9fef6ddd"
# oldAppName="通用小程序"
# if grep -q ${oldAppid} ./src/ext.json
# then
# sed -i "" "s#${oldAppid}#${appid}#g" ./src/ext.json
# sed -i "" "s#${oldAppName}#${appName}#g" ./src/ext.json
# sed -i "" "s#${oldAppid}#${appid}#g" ./project.config.json
# echo "【SUCCESS】替换appid成功"
# else
# echo "【ERROR】待替换的小程序APPID ${oldAppid} 在./src/ext.json 中不存在"
# exit
# fi
# PROJECT_FILE_PATH='./project.config.json'
# oldappid=$(cat ${PROJECT_FILE_PATH} | sed 's/,/\n/g' | grep "appid" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g')
# sed -i "" "s#${oldappid}#\"${appid}\"#g" ${PROJECT_FILE_PATH}
echo '{
"extEnable": true,
"extAppid": "'${appid}'",
"ext": {
"company_id": "'${company_id}'",
"appid": "'${appid}'",
"wxa_name": "'${appName}'",
"ali_isvid":"'${ali_isvid}'"
},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "微商城",
"navigationBarTextStyle": "black"
}
}' > ./src/ext.json
echo 'APP_BASE_URL='${baseUrl}'
APP_WEBSOCKET='${websocket}'
APP_COMPANY_ID='${company_id}'
APP_PLATFORM='${platform}'
APP_CUSTOM_SERVER='${custom_server}'
APP_HOME_PAGE='${home_page}'
APP_TRACK=youshu
APP_YOUSHU_TOKEN=bi281e87ab2424481a
APP_ID='${appid}'
APP_MAP_KEY='${map_key}'
APP_MAP_NAME='${map_name}'
APP_IMAGE_CDN='${image_cdn}'
APP_DIANWU_URL='${dianwu_url}'
APP_MERCHANT_URL='${merchant_url}'
APP_ADAPAY='${adapay}'
' > ./.env
echo "请选择编译方式"
buildType='weapp h5 alipay'
select type in $buildType
do
if [ "$type" == 'weapp' ]
then
echo "npm run build:weapp"
yarn run build:weapp
elif [ "$type" == 'alipay' ]
then
echo "npm run build:alipay"
yarn run build:h5
else
echo "npm run build:h5"
yarn run build:alipay
fi
break
done

43
src/api/aftersales.js Executable file
View File

@ -0,0 +1,43 @@
import req from './req'
export function list (params) {
return req.get('/aftersales', params)
}
export function info (params) {
return req.get('/aftersales/info', params)
}
export function apply (params) {
return req.post('/aftersales', params)
}
export function modify (params) {
return req.post('/aftersales/modify', params)
}
export function sendback (params) {
return req.post('/aftersales/sendback', params)
}
export function close (params) {
return req.post('/aftersales/close', params)
}
export function reasonList (params = {}) {
return req.get('/aftersales/reason/list', params)
}
export function remindDetail (params = {}) {
return req.get('/aftersales/remind/detail', params)
}
/**
* @param {*} params
* distributor_id 下单门店
* lng 经度
* lat 纬度
* @returns
*/
export function getAfterSaleStoreList(params) {
return req.get('/distributor/aftersaleslocation', params)
}

35
src/api/alipay.js Executable file
View File

@ -0,0 +1,35 @@
import Taro from '@tarojs/taro'
import req from './req'
import { getAppId } from '@/utils'
const useauth = {
auth_type: 'alipayapp',
user_type: 'alipay'
}
/**支付宝自动登录 */
export function login (params) {
return req.post('/alipay/login', {
...params,
...useauth,
appid: getAppId()
})
}
/**支付宝手动登录(注册) */
export function newlogin (params) {
return req.post('/alipay/new_login', {
...params,
...useauth,
appid: getAppId()
})
}
export function alipay_login (params) {
return req.post(`/new_login`, {
...params
})
}
export function alipay_qrcode (params) {
return req.get(`/alipaymini/qrcode.png?${params}`)
}

54
src/api/article.js Executable file
View File

@ -0,0 +1,54 @@
import req from './req'
export function list (params = {}) {
return req.get('/article/management', params)
}
export function authList (params = {}) {
return req.get('/article/usermanagement', params)
}
export function detailAuth (id) {
return req.get(`/article/usermanagement/${id}`)
}
export function detail (id) {
return req.get(`/article/management/${id}`)
}
export function focus (id) {
return req.get(`/article/focus/${id}`)
}
export function praise (id) {
return req.get(`/article/praise/${id}`)
}
export function praiseCheck (id) {
return req.get(`/article/praise/check/${id}`)
}
export function praiseNum (id) {
return req.get(`/article/praise/num/${id}`)
}
export function totalCollectArticle (params = {}) {
return req.get('/member/collect/article', params)
}
export function collectArticle (id) {
return req.post(`/member/collect/article/${id}`)
}
export function delCollectArticle (params = {}) {
return req.delete('/member/collect/article', params)
}
export function collectArticleInfo (params = {}) {
return req.get('/member/collect/article/info', params)
}
export function columnList () {
return req.get('/article/category')
}
export default {}

33
src/api/boost.js Executable file
View File

@ -0,0 +1,33 @@
import req from './req'
import { transformPlatformUrl } from '@/utils/platform'
// 获取助力列表
export const getList = (param = {}) => req.get('/promotion/bargains', param)
// 获取助力配置
export const getDetail = (param = {}) =>
req.get(transformPlatformUrl('/alipay/pageparams/setting'), param)
// 获取助力详情
export const getUserBargain = (param = {}) => req.get('/promotion/userbargain', param)
// 发起助力
export const postUserBargain = (param = {}) => req.post('/promotion/userbargain', param)
// 支付
export const pay = (param = {}) => req.post('/order', param)
// 获取支付配置
export const getPayConfig = (param = {}) => req.get('/payment/config', param)
// 砍价
export const postDiscount = (param = {}) => req.post('/promotion/bargainlog', param)
// 小程序码
export const getCodeUrl = (param = {}) => req.get('/promotion/bargainfriendwxappcode', param)
// 获取订单列表
export const getOrderList = (param = {}) => req.get('/orders', param)
// 获取订单详情
export const getOrderDetail = (param = {}) => req.get(`/order/${param.order_id}`, param)

103
src/api/cart.js Executable file
View File

@ -0,0 +1,103 @@
import req from './req'
import { getDistributorId } from '@/utils'
export function get(params) {
return req.get('/cart/list', params)
}
export function count(params) {
const { shop_type = 'distributor' } = params
return req.get('/cartcount', {
shop_type,
...params
})
}
export function add(params) {
return req.post(`/cart`, params)
}
export function fastBuy(params, isPointitem) {
const { item_id, num = 1, bargain_id, distributor_id } = params
const query = {
cart_type: 'fastbuy',
item_id,
num,
distributor_id,
isAccumulate: false,
shop_type: isPointitem ? 'pointsmall' : 'distributor'
}
if (bargain_id) {
query.bargain_id = bargain_id
}
return req.post('/cart', query)
}
export function del({ cart_id }) {
return req.delete('/cartdel', { cart_id })
}
export function select({ cart_id, is_checked }) {
return req.put('/cartupdate/checkstatus', { cart_id, is_checked })
}
export function updateNum(shop_id, cart_id, num, shop_type) {
return req.put(`/cartupdate/num`, {
shop_id,
cart_id,
num,
isAccumulate: false,
shop_type
})
// return req.put('/cartupdate/num', { cart_id, num })
}
export function updatePromotion({ cart_id, activity_id }) {
return req.put('/cartupdate/promotion', { cart_id, activity_id })
}
export function checkout() {
return req.get('/cart.checkout')
}
export function total(params) {
// return req.post('/cart.total')
return req.post('/getFreightFee', params)
}
export function coupons(params) {
return req.get('/user/newGetCardList', params)
}
export function likeList(params) {
const distributor_id = getDistributorId()
return req.get('/promotions/recommendlike', {
distributor_id,
...params
})
}
export function selectedPlusitem(params) {
return req.post('/cart/check/plusitem', params)
}
// 消息通知
export function getCartRemind(params) {
return req.get('/cartremind/setting', params)
}
// 兑换商品
export function exchangeGood(params) {
return req.post('user/exchangeCard', params)
}
// 获取街道、社区列表
export function getSubdistrict(params) {
return req.get('/espier/subdistrict', params)
}
// 获取自提点列表
export function getZitiList(params) {
return req.get('/distributor/pickuplocation', params)
}

23
src/api/cashier.js Executable file
View File

@ -0,0 +1,23 @@
import req from './req'
export function getOrderDetail (order_id) {
return req.get(`/order/${order_id}`)
}
export function getPayment (params = {}) {
// params = {
// ...params,
// open_id: 'olp694lNHedXSGa3HPrqj6nPILOU'
// }
return req.post('/payment', params)
}
export function getWeappUrlLink(params = {}) {
return req.post('/urllink', params)
}
export function getWeappUrlSchema(params = {}) {
return req.post('/urlschema', params)
}

10
src/api/category.js Executable file
View File

@ -0,0 +1,10 @@
import req from './req'
import { transformPlatformUrl } from '@/utils/platform'
export function get (params) {
return req.get('/goods/category', params)
}
export function getCategory (params = {}) {
return req.get('/pageparams/setting', params)
}

139
src/api/community.js Executable file
View File

@ -0,0 +1,139 @@
import req from './req'
export function getCommunityList(params) {
return req.get('/community/orders', params)
}
export function getActivityList(params) {
// 获取团长活动列表
return req.get('/community/chief/activity', params)
}
export function getMemberActivityList(params) {
// 个人中心活动列表
return req.get('/community/member/activity', params)
}
export function createActivityZiti(params) {
return req.post('/community/chief/ziti', params)
}
export function modifyActivityZiti(id, params) {
return req.post(`/community/chief/ziti/${id}`, params)
}
export function getActivityZiti(id) {
return req.get(`/community/chief/ziti`)
}
export function getChiefItems(params) {
return req.get(`/community/chief/items`, params)
}
export function createChiefActivity(params) {
return req.post('/community/chief/activity', params)
}
export function getChiefActivity(activity_id) {
return req.get(`/community/chief/activity/${activity_id}`)
}
export function modiflyChiefActivity(activity_id, params) {
return req.post(`/community/chief/activity/${activity_id}`, params)
}
export function confirmDelivery(activity_id) {
// 团长确认收货
return req.post(`/community/chief/confirm_delivery/${activity_id}`)
}
export function checkChief() {
// 检查用户是否是团长
return req.post('/community/checkChief')
}
export function getActiveDetail(activity_id) {
// 消费者获取活动详情
return req.get(`/community/member/activity/${activity_id}`)
}
// export function getChiefActiveDetail(activity_id) {
// // 团长获取活动详情
// return req.get(`/community/chief/activity/${activity_id}`)
// }
export function updateActivityStatus(activity_id, parmas) {
// 团长修改活动状态
return req.post(`/community/chief/activity_status/${activity_id}`, parmas)
}
export function exportOrder(parmas) {
// 导出团购订单
return req.get(`/community/orders/export`, parmas)
}
export function scanOrderCode(parmas) {
// 核销码
return req.post('/community/orders/qr_writeoff', parmas)
}
export function activityOrderItem(activity_id) {
// 团长查看活动商品统计
return req.post(`/community/chief/activity_order_item/${activity_id}`)
}
export function closeCode(parmas) {
// 活动核销码
return req.post(`/community/orders/batch_writeoff`, parmas)
}
// 获取所有可团商品
export function getMemberItems(params) {
return req.get('/community/member/items', params)
}
// 获取申请信息
export function getAppayFields(params) {
return req.get('/community/chief/apply_fields', params)
}
// 提交申请
export function applyChief(params) {
return req.post('/community/chief/apply', params)
}
// 获取申请进度
export function getApplyChief(params) {
return req.get('/community/chief/apply', params)
}
// 获取团长申请说明
export function aggrementAndExplanation(params) {
return req.get('/community/chief/aggrement_and_explanation', params)
}
// 团长业绩统计
export function getChiefCashWithdraw() {
return req.get('/community/chief/cash_withdrawal/count')
}
// 团长提现记录
export function getCashWithDraw(params) {
return req.get('/community/chief/cash_withdrawal', params)
}
// 获取团长提现账户
export function getCashWithDrawAccount() {
return req.get('/community/chief/cash_withdrawal/account' )
}
// 更新团长提现账户
export function updateCashWithDrawAccount(params) {
return req.post('/community/chief/cash_withdrawal/account', params)
}
// 团长佣金提现申请
export function chiefCashWithdraw(params) {
return req.post('/community/chief/cash_withdrawal', params)
}

16
src/api/consts.js Executable file
View File

@ -0,0 +1,16 @@
export const HTTP_STATUS = {
SUCCESS: 200,
CREATED: 201,
ACCEPTED: 202,
CLIENT_ERROR: 400,
UNAUTHORIZED: 401,
FORBIDDEN: 403,
NOT_FOUND: 404,
SERVER_ERROR: 500,
BAD_GATEWAY: 502,
SERVICE_UNAVAILABLE: 503,
GATEWAY_TIMEOUT: 504,
BUSINESS_ERROR: 422,
TOKEN_NEEDS_REFRESH: 401001,
USER_FORBIDDEN: 401002
}

129
src/api/dianwu.js Executable file
View File

@ -0,0 +1,129 @@
// import req from './req-dianwu'
import { API } from './req'
const req = new API({
baseURL: process.env.APP_BASE_URL.replace('/h5app/wxapp', '')
})
export function goodsItems(params) {
return req.get('/goods/items/onsale', params)
}
// 商品加入收银台
export function addToCart(params) {
return req.post('/operator/cartdataadd', params)
}
// 扫码加入收银台
export function scanAddToCart(params) {
return req.post('/operator/scancodeAddcart', params)
}
// 收银台数据查询
export function getCartDataList(params) {
return req.get('/operator/cartdatalist', params)
}
// 收银台更新
export function updateCartData(params) {
return req.post('/operator/cartdataupdate', params)
}
// 删除收银台商品
export function deleteCartData(cart_id) {
return req.delete(`/operator/cartdatadel?cart_id=${cart_id}`)
}
// 会员查询接口
export function getMembers(params) {
return req.get('/members', params)
}
// 会员创建
export function createMember(params) {
return req.post('/member', params)
}
// 收银台结算
export function checkout(params) {
return req.post('/checkout', params)
}
// 订单创建
export function createOrder(params) {
return req.post('/order/create', params)
}
// 支付
export function orderPayment(params) {
return req.post('/order/payment', params)
}
// 支付结果查询
export function getPaymentResultByOrder(params) {
return req.get('/order/payment/query', params)
}
// 订单详情
export function getTradeDetail(order_id) {
return req.get(`/order/${order_id}`)
}
// 根据userid查询会员
export function getMemberByUserId(params) {
return req.get(`/member`, params)
}
// 获取优惠券
export function getUserCardList(params) {
return req.get('/getUserCardList', params)
}
// 挂单
export function orderPendding(params) {
return req.post('/operator/cartdata/pending', params)
}
// 取单
export function fetchPendding(params) {
return req.post('/operator/pending/fetch', params)
}
// 挂单列表
export function penddingList(params) {
return req.get('/operator/pending/list', params)
}
// 删除挂单
export function penddingDelete(params) {
return req.delete('/operator/pending/delete', params)
}
// 改价
export function changePrice (params) {
return req.post('/order/markdown', params)
}
// 改价确认
export function changePriceConfirm (params) {
return req.post('/order/markdown/confirm', params)
}
export function is_admin(params) {
return req.get('/distributor/bind/checkout', params)
}
// 订单取消
export function cancelTrade(params) {
return req.post(`/order/${params.order_id}/cancel`, params)
}
// 申请售后
export function salesAfterApply(params) {
return req.post('/aftersales/apply', params)
}
//开票
export function openBill(params) {
return req.post('/invoice/invoiced', params)
}

111
src/api/distribution.js Executable file
View File

@ -0,0 +1,111 @@
import req from './req'
export function become() {
return req.post('/promoter')
}
export function update(params = {}) {
return req.put('/promoter', params)
}
export function dashboard() {
return req.get('/promoter/index')
}
export function info(params = {}) {
return req.get('/promoter/info', params)
}
export function subordinate(params) {
return req.get('/promoter/children', params)
}
export function commission(params = {}) {
return req.get('/promoter/brokerages', params)
}
export function statistics() {
return req.get('/promoter/brokerage/count')
}
export function withdrawRecord(params) {
return req.get('/promoter/cash_withdrawal', params)
}
export function withdraw() {
return req.post('/promoter/cash_withdrawal')
}
export function qrcode(params) {
return req.get('/promoter/qrcode', params)
}
export function items(params) {
return req.get('/promoter/relgoods', params)
}
export function release(params) {
return req.post('/promoter/relgoods', params)
}
export function unreleased(params) {
return req.delete('/promoter/relgoods', params)
}
export function shopAchievement(params) {
return req.get('/promoter/taskBrokerage/count', params)
}
export function shopTrade(params) {
return req.get('/promoter/taskBrokerage/logs', params)
}
export function shopBanner(params) {
return req.get('/promoter/banner', params)
}
export function getCategorylevel(params) {
return req.get('/goods/categorylevel', params)
}
// 小店上架分类
export function getShopCategorylevel(params) {
return req.get('/goods/shopcategorylevel', params)
}
export function getCustompage() {
return req.get('/promoter/custompage')
}
export function getCash(params) {
return req.post('/promoter/cash_withdrawal', params)
}
// 获取小店上架商品
export function getShopGoods(params) {
return req.get('/goods/shopitems', params)
}
// 查询商家是否可用
export function merchantIsvaild(params) {
return req.get(`/distributor/merchant/isvaild`, params)
}
// 获取分销员认证信息
export function adapayCert(params) {
return req.get('/adapay/popularize/cert', params)
}
// 新建分销员认证信息
export function adapayCreateCert(params) {
return req.post('/adapay/popularize/create_cert', params)
}
// 修改分销员认证信息
export function adapayUpdateCert(params) {
return req.post('/adapay/popularize/update_cert', params)
}
// 获取店铺信息
export function getDistributorInfo({ distributor_id }) {
return req.get(`/distributor/getDistributorInfo?distributor_id=${distributor_id}`)
}

13
src/api/group.js Executable file
View File

@ -0,0 +1,13 @@
import req from './req'
export function groupList (params = {}) {
return req.get('/promotions/groups', params)
}
export function groupDetail (id, params = {}) {
return req.get(`/groupOrders/${id}`, params)
}
export function myGroupList (params = {}) {
return req.get('/groupOrders', params)
}

279
src/api/groupBy.js Executable file
View File

@ -0,0 +1,279 @@
import req from './req'
import { transformPlatformUrl } from '@/utils/platform'
// 登录
export const login = (param = {}) => req.post('/wxa/promotion/articles', param)
// 获取信息
export const info = (param = {}) => req.get('/member', param)
// export const info = (param = {}) => req.get('/userinfo', param)
// identity
export const identity = (param = {}) => req.get('/distributor', param)
// 获取模版
export const getTemplate = (param = {}) =>
req.get(transformPlatformUrl('/alipay/pageparams/setting'), param)
// promotionArticles
export const promotionArticles = (param = {}) => req.get('/promotion/articles', param)
// promotionArticlesInfo
export const promotionArticlesInfo = (param = {}) => req.get('/wxa/promotion/articles/info', param)
// showMemberCode
export const showMemberCode = (param = {}) => req.get('/barcode', param)
// 获取店铺设置
export const getCompanySetting = (param = {}) => req.get('/company/setting', param)
// 获取分类列表
export const getCategoryList = (param = {}) => req.get('/goods/category', param)
// 获取购物车数据
export const getCart = (param = {}) => req.get('/cart', param)
// 更新购物车
export const updateCart = (param = {}) => req.post('/cart', param)
// 更新商品数量
export const updateGoodNum = (param = {}) => req.put('/cartupdate/num', param)
// 更新商品选中状态
export const updateCheckGood = (param = {}) => req.put('/cartupdate/checkstatus', param)
// 删除商品
export const deleteGood = (param = {}) => req.delete('/cartdel', param)
// 会员注册设置
export const registerSetting = (param = {}) => req.get('/member/setting', param)
// 会员信息
export const memeberInfo = (param = {}) => req.get('/member', param)
// 会员注册
export const memberRegister = (param = {}) => req.post('/member', param)
// decryptPhoneNumber
export const decryptPhoneNumber = (param = {}) => req.get('/member/decryptPhoneInfo', param)
// receiveVip
export const receiveVip = (param = {}) => req.get('/promotion/getMemberCard', param)
// card列表
export const getCardList = (param = {}) => req.get('/getCardList', param)
// userCardList
export const getUserCardList = (param = {}) => req.get('/user/newGetCardList', param)
// receiveCard
export const receiveCard = (param = {}) => req.get('/user/effectiveCardlist', param)
// getCardDetail
export const getCardDetail = (param = {}) => req.get('/user/getCardDetail', param)
// useUserCard
export const useUserCard = (param = {}) => req.get('/user/usedCard', param)
// 支付设置
export const payConfig = (param = {}) => req.get('/payment/config', param)
// 门店列表
export const getStoreList = (param = {}) => req.get('/distributor/list', param)
// 店铺列表
export const getShopList = (param = {}) => req.get('/shops/wxshops', param)
// 附近店铺列表
export const getNearShop = (param = {}) => req.get('/shops/getNearestWxShops', param)
// 店铺详情
export const getShopDetail = (param = {}) => req.get('/shops/wxshops', param)
// getRechargeRules
export const getRechargeRules = (param = {}) => req.get('/weapp/deposit/rechargerules', param)
// getRechargeAgreement
export const getRechargeAgreement = (param = {}) =>
req.get('/weapp/deposit/recharge/agreement', param)
// deposit recharge
export const depositRecharge = (param = {}) => req.post('/weapp/deposit/recharge', param)
// item list
export const getItemList = (param = {}) => req.get('/goods/items', param)
// item detail
export const getItemDetail = (param = {}) => req.get('/goods/items/', param)
// reservation add
export const addReservation = (param = {}) => req.post('/reservation', param)
// reservation getDateList
export const getDateList = (param = {}) => req.get('/reservation/dateDay', param)
// reservation getTimeList
export const getTimeList = (param = {}) => req.get('/reservation/timelist', param)
// getRecordList
export const getRecordList = (param = {}) => req.get('/reservation/recordlist', param)
// getCount
export const getCount = (param = {}) => req.get('/reservation/getCount', param)
// getCanReservationRights
export const getCanReservationRights = (param = {}) => req.get('/can/reservation/rights', param)
// rights list
export const getRightsList = (param = {}) => req.get('/rights', param)
// rights detail
export const getRightsDetail = (param = {}) => req.get('/rights', param)
// rights code
export const getRightsCode = (param = {}) => req.get('/rightscode', param)
// rights logs
export const getRightsLogs = (param = {}) => req.get('/rightsLogs', param)
// tracks viewnum
export const viewNum = (param = {}) => req.post('/track/viewnum', param)
// 创建订单
export const createOrder = (param = {}) => req.post('/order', param)
// 获取订单列表
export const getOrderList = (param = {}) => req.get('/orders', param)
// 获取订单数量
export const getOrderCount = (param = {}) => req.get('/orders/count', param)
export const getOrderCounts = (param = {}) => req.get('/orderscount', param)
// 获取订单详情
export const getOrderDetail = (param = {}) => req.get(`/order/${param.orderId}`)
// 计算订单
export const getCalculateTotal = (param = {}) => req.post('/getFreightFee', param)
// 获取自提码
export const getZitiCode = (param = {}) => req.get('/ziticode', param)
// 取消订单
export const cancelOrder = (param = {}) => req.post('/order/cancel', param)
// 确认收据
export const confirmReceipt = (param = {}) => req.post('/order/confirmReceipt', param)
// 售后申请
export const applyAfterSale = (param = {}) => req.post('/aftersales', param)
// 售后信息
export const getAfterSale = (param = {}) => req.get('/aftersales/info', param)
// 售后列表
export const getAfterList = (param = {}) => req.get('/aftersales', param)
// 关闭售后
export const closeAfterSale = (param = {}) => req.post('/aftersales/close', param)
// 发送反馈
export const sendBack = (param = {}) => req.post('/aftersales/sendback', param)
// 修改售后
export const modifyAfterSale = (param = {}) => req.post('/aftersales/modify', param)
// promotion
export const promotionFormId = (param = {}) => req.post('/promotion/formid', param)
// promotion register
export const promotionRegister = (param = {}) => req.post('/promotion/register', param)
// cash list
export const getCashList = (param = {}) => req.get('/cash_withdrawals', param)
// cash Application
export const cashApplication = (param = {}) => req.get('/cash_withdrawal', param)
// cash statics
export const getCashStatics = (param = {}) => req.get('/distributor/count', param)
// cash distributorIsValid
export const getCashDistributorIsValid = (param = {}) => req.get('/distributor/is_valid', param)
// 文章
export const viewArticle = (param = {}) => req.get('/article/management', param)
// 会员等级
export const vipBuy = (param = {}) => req.post('/vipgrades/buy', param)
// 会员购列表
export const getVipList = (param = {}) => req.get('/vipgrades/newlist', param)
// userVip
export const getUserVip = (param = {}) => req.get('/vipgrades/uservip', param)
// currency default
export const currencyDefault = (param = {}) => req.get('/currencyGetDefault', param)
// beDistributor
export const beDistributor = (param = {}) => req.post('/promoter', param)
// reDistributor
export const reDistributor = (param = {}) => req.put('/promoter', param)
// promoter index
export const promoterIndex = (param = {}) => req.get('/promoter/index', param)
// promoterInfo
export const promoterInfo = (param = {}) => req.get('/promoter/info', param)
// promoter children
export const promoterChildren = (param = {}) => req.get('/promoter/children', param)
// promoter brokerages
export const promoterBrokerages = (param = {}) => req.get('/promoter/brokerages', param)
// promoter statistics
export const promoterStatistics = (param = {}) => req.get('/promoter/brokerage/count', param)
// propmoter withdrawRecord
export const promoterWithdrawRecord = (param = {}) => req.get('/promoter/cash_withdrawal', param)
// promoter withdraw
export const promoterWithdraw = (param = {}) => req.post('/promoter/cash_withdrawal', param)
// promoter qrcode
export const promoterQrcode = (param = {}) => req.get('/promoter/qrcode', param)
// 图片上传
export const uploadImage = (param = {}) => req.get('/espier/image_upload_token', param)
// 活动详情
export const activityDetail = (param = {}) =>
req.get('/promotion/community/activityitemslist', param)
// 活动商品详情
export const activityGoodDetail = (param = {}) =>
req.get('/promotion/community/activityitemsinfo', param)
// 附近活动社区
export const activityCommunity = (param = {}) => req.get('/promotion/community/nearInfo', param)
// 活动社区列表
export const activityCommunityList = (param = {}) => req.get('/promotion/community/list', param)
// 活动社区详情
export const activityCommunityDetail = (param = {}) => req.get('/promotion/community/info', param)
// updateSalesCount
export const updateSalesCount = (param = {}) =>
req.get('/promotion/community/activityitemsales', param)
// getActivitySaleHistory
export const getActivitySaleHistory = (param = {}) =>
req.get('/promotion/community/activitySaleHistory', param)
// getActivityItemSaleHistory
export const getActivityItemSaleHistory = (param = {}) =>
req.get('/promotion/community/activityItemSaleHistory', param)

76
src/api/guide.js Executable file
View File

@ -0,0 +1,76 @@
import req from './req'
import S from '@/spx'
import { transformPlatformUrl } from '@/utils/platform'
function createHead() {
return {
header: {
'x-wxapp-session': (S && S.getAuthToken()) || '',
'salesperson-type': 'shopping_guide'
}
}
}
//获取首页导购模版
export function getHomeTmps(params = {}, config = createHead()) {
return req.get(transformPlatformUrl('/pageparams/setting'), params, config)
}
//获取导购店铺列表
export function distributorlist(params = {}, config = createHead()) {
return req.get('/salesperson/distributorlist', params, config)
}
//验证导购员的店铺id是否有效
export function is_valid(params = {}, config = createHead()) {
return req.get('/salesperson/distributor/is_valid', params, config)
}
//扫条形码加入购物车
export function scancodeAddcart(params = {}, config = createHead()) {
return req.post('/salesperson/scancodeAddcart', params, config)
}
// //计算导购分享订单商品金额
// export function salesPromotion(params = {}, config = createHead()) {
// return req.post("/salesperson/salesPromotion", params, config);
// }
//导购员购物车新增
export function cartdataadd(params = {}, config = createHead()) {
return req.get('/salesperson/cartdataadd', params, config)
}
//导购员购物车更新
export function cartdataupdate(params = {}, config = createHead()) {
return req.get('/salesperson/cartdataupdate', params, config)
}
//获取导购员购物车列表
export function cartdatalist(params = {}, config = createHead()) {
return req.get('/salesperson/cartdatalist', params, config)
}
// 获取购物车数量
export function cartCount(params = {}, config = createHead()) {
return req.get('/salesperson/cartcount', params, config)
}
//导购员购物车删除
export function cartdatadel(params = {}, config = createHead()) {
return req.get('/salesperson/cartdatadel', params, config)
}
//导购购物车选中状态变更
export function checkstatus(params = {}, config = createHead()) {
return req.put('/salesperson/cartupdate/checkstatus', params, config)
}
//生成海报的二维码,增加一个参数 salesman_distributor_id:导购的店铺id
//计算导购分享订单商品金额
export function salesPromotion(params = {}, config = createHead()) {
return req.get('/salesperson/salesPromotion', params, config)
}
//获取导购货架商品列表 wxapp/goods/salesperson/items
export function salespersonItems(params = {}, config = createHead()) {
return req.get('/goods/salesperson/items', params, config, { showLoading: true })
}
// 更新导购敏感信息
export function updateBAInfo(params = {}, config = createHead()) {
return req.post("/salesperson/bainfo", params, config);
}

5
src/api/im.js Executable file
View File

@ -0,0 +1,5 @@
import req from './req'
export function getImConfigByDistributor (distributor_id) {
return req.get(`/im/meiqia/distributor/${distributor_id}`)
}

67
src/api/index.js Executable file
View File

@ -0,0 +1,67 @@
import * as article from './article'
import * as aftersales from './aftersales'
import * as cart from './cart'
import * as cashier from './cashier'
import * as category from './category'
import * as distribution from './distribution'
import * as item from './item'
import * as member from './member'
import * as promotion from './promotion'
import * as region from './region'
import * as seckill from './seckill'
import * as shop from './shop'
import * as track from './track'
import * as trade from './trade'
import * as user from './user'
import * as vip from './vip'
import * as group from './group'
import * as groupBy from './groupBy'
import * as boost from './boost'
import * as wx from './wx'
import * as alipay from './alipay'
import * as wheel from './wheel'
import * as pointitem from './pointitem'
import * as liveroom from './liveroom'
import * as wgts from './wgts'
import * as merchant from './merchant'
import * as purchase from './purchase'
import * as guide from './guide'
import * as dianwu from './dianwu'
import * as community from './community'
import * as im from './im'
import * as mdugc from './mdugc'
export default {
article,
aftersales,
cart,
cashier,
category,
item,
member,
promotion,
region,
trade,
user,
seckill,
wx,
shop,
distribution,
track,
vip,
group,
groupBy,
wheel,
boost,
pointitem,
guide,
alipay,
liveroom,
wgts,
merchant,
purchase,
dianwu,
community,
im,
mdugc
}

74
src/api/item.js Executable file
View File

@ -0,0 +1,74 @@
import req from './req'
export function search (params = {}) {
// return req.get('/item.search', params)
return req.get('/goods/items', params)
}
export function detail (item_id, params = {}) {
return req.get(`/goods/items/${item_id}`, params)
}
export function desc (item_id) {
return req.get('/item.desc', { item_id })
}
export function rateList (item_id) {
return req.get('/item.rate.list', { item_id })
}
export function category () {
return req.get('/category.itemCategory')
}
export function seckillCheck ({ item_id, num = 1, seckill_id }) {
return req.get('/promotion/seckillactivity/geticket', {
item_id,
num,
seckill_id
})
}
export function seckillCancelCheck () {
return req.delete('/promotion/seckillactivity/cancelTicket')
}
export function packageList (params = {}) {
return req.get('/promotions/package', params)
}
export function packageDetail (item_id) {
return req.get(`/promotions/package/${item_id}`)
}
export function evaluationList (params) {
return req.get('/order/rate/list', params)
}
export function replyRate (params) {
return req.post('/order/replyRate', params)
}
export function getEvaluationDetail (rate_id, params = {}) {
return req.get(`/order/rate/detail/${rate_id}`, params)
}
export function getreplyRateList (params = {}) {
return req.get(`/order/replyRate/list`, params)
}
export function getRatePraiseStatus (params = {}) {
return req.get(`/order/ratePraise/status`, params)
}
export function getDetailShare (params) {
return req.post('/salesperson/task/share', params)
}
// 获取分享配置
export function getShareSetting (id) {
return req.get(`/goods/share/items/${id}`)
}
// 获取是否分享携带店铺id配置
export function getShareDtidSetting () {
return req.get(`/common/setting`)
}

11
src/api/liveroom.js Executable file
View File

@ -0,0 +1,11 @@
import req from './req'
export function getLiveRoomList (params = {}) {
// 获取直播列表
return req.get('/promotion/live/list', params)
}
export function getReturnList () {
// 获取视频回放列表
return req.get('/promotion/replay/list')
}

109
src/api/mdugc.js Executable file
View File

@ -0,0 +1,109 @@
import req from './req'
// 首页列表
export function yuyueActivityList(data) {
return req.get("/article/usermanagement", data);
}
// 笔记
// 笔记列表
export function postlist(data) {
return req.get("/ugc/post/list", data);
}
// 发布笔记
export function create( params ) {
return req.post("/ugc/post/create",params)
}
// 笔记详情
export function postdetail(params) {
return req.get("/ugc/post/detail", params);
}
// 笔记点赞
export function postlike( params ) {
return req.post("/ugc/post/like",params)
}
// 收藏|取消收藏
export function postfavorite( params ) {
return req.post("/ugc/post/favorite",params)
}
// 删除笔记
export function postdelete( params ) {
return req.post("/ugc/post/delete",params)
}
// 分享笔记
export function postshare( params ) {
return req.post("/ugc/post/share",params)
}
// 笔记设置
export function postsetting(params) {
return req.get("/ugc/post/setting", params);
}
// tag
// 添加tag
export function tagcreate( params ) {
return req.post("/ugc/tag/create",params)
}
// tag列表
export function taglist( params ) {
return req.get("/ugc/tag/list",params)
}
// 话题
// 创建话题
export function topiccreate( params ) {
return req.post("/ugc/topic/create",params)
}
// 话题列表
export function topiclist( params ) {
return req.get("/ugc/topic/list",params)
}
// 评论
// 发表评论
export function commentcreate( params ) {
return req.post("/ugc/comment/create",params)
}
// 评论列表
export function commentlist( params ) {
return req.get("/ugc/comment/list",params)
}
// 点赞评论
export function commentlike( params ) {
return req.post("/ugc/comment/like",params)
}
// 删除评论
export function commentdelete( params ) {
return req.post("/ugc/comment/delete",params)
}
// 粉丝
// 获取粉丝列表
export function followerlist( params ) {
return req.get("/ugc/follower/list",params)
}
// 关注|取消关注
export function followercreate( params ) {
return req.post("/ugc/follower/create",params)
}
// 获取统计数量
export function followerstat( params ) {
return req.get("/ugc/follower/stat",params)
}
// 消息
// 设置为已读(按类型,从哪个类型点进去就发起请求
export function messagesetTohasRead( params ) {
return req.post("/ugc/message/setTohasRead",params)
}
// 获取消息列表
export function messagelist( params ) {
return req.get("/ugc/message/list",params)
}
// 获取消息详情
export function messagedetail( params ) {
return req.get("/ugc/message/detail",params)
}
// 消息桌面
export function messagedashboard( params ) {
return req.get("/ugc/message/dashboard",params)
}

385
src/api/member.js Executable file
View File

@ -0,0 +1,385 @@
import req from './req'
import { platformTemplateName, transformPlatformUrl } from '@/utils/platform'
export function memberInfo() {
return req.get('/member')
}
// 修改用户信息
export function setMemberInfo(params = {}) {
return req.put('/member', params)
}
export function updateMemberInfo(params = {}) {
return req.put('/memberinfo', params)
}
// 注销用户
export function deleteMember(params) {
return req.delete('/member', params)
}
// 更新会员手机号
export function setMemberMobile(params = {}) {
return req.put('/member/mobile', params)
}
export function pointDetail() {
return req.get('/member.point.detail')
}
export function favsList(params = {}) {
return req.get('/member/collect/item', params, null, { showError: false })
}
export function addFav(item_id, params) {
return req.post(`/member/collect/item/${item_id}`, params)
}
export function delFav(item_ids, params = {}) {
item_ids = Array.isArray(item_ids) ? item_ids : [item_ids]
const { is_empty = false } = params
return req.delete('/member/collect/item', {
item_ids,
is_empty
})
}
export function memberAssets() {
return req.get(`/member/statistical`)
}
export function couponList(params = {}) {
return req.get('/user/newGetCardList', params)
}
export function getUserCardList(params = {}) {
return req.get('/user/getUserCardList', params)
}
export function homeCouponList(params = {}) {
return req.get('/getCardList', params)
}
export function homeCouponGet(params = {}) {
return req.get('/user/receiveCard', params)
}
export function getCardDetail(params = {}) {
return req.get('/user/getCardDetail', params)
}
export function userUsedCard(params = {}) {
return req.get('/user/usedCard', params)
}
export function addressList(params) {
return req.get('/member/addresslist', params)
}
export function crmAddressList(params = {}) {
//获取crm地址
return req.post('/member/crmaddresslist', params)
}
export function addressCreate(params = {}) {
return req.post('/member/address', params)
}
export function addressUpdate(data) {
return req.put(`/member/address/${data.address_id}`, data)
}
export function addressDelete(address_id) {
return req.delete(`/member/address/${address_id}`)
}
/*export function areaList () {
return req.get('/member/addressarea')
}*/
export function areaList() {
return req.get('/espier/address')
}
export function addressCreateOrUpdate(data) {
const fn = data.address_id ? addressUpdate : addressCreate
return fn(data)
}
export function itemHistorySave(item_id) {
return req.post('/member/browse/history/save', { item_id })
}
export function itemHistory(params) {
return req.get('/member/browse/history/list', params)
}
export function getRechargeNumber() {
return req.get('/deposit/rechargerules')
}
// 充值
export function rehcargePay(params) {
return req.post('/deposit/recharge', params)
}
export function qrcodeData() {
return req.get('/promoter/qrcode')
}
export function memberCode(params) {
return req.get('/barcode', params)
}
export function promoter() {
return req.post('/promoter')
}
export function h5_qrcodeData() {
return req.get('/brokerage/qrcode')
}
export function pointList(params = {}) {
return req.get('/member/dh/point/history', params)
}
export function pointTotal() {
return req.get('/point/member/info')
}
export function depositList(params = {}) {
return req.get('/deposit/list', params)
}
export function depositTotal() {
return req.get('/deposit/info')
}
export function depositPay(params = {}) {
return req.post('/deposit/recharge_new', params)
}
export function depositPayRule() {
return req.get('/deposit/recharge/agreement')
}
export function formId(formid) {
return req.post('/promotion/formid', { formid })
}
export function recommendUserInfo() {
return req.get('/promoter/info')
}
export function recommendIndexInfo() {
return req.get('/promoter/index')
}
export function recommendMember(params = {}) {
return req.get('/promoter/children', params)
}
export function recommendOrder(params = {}) {
return req.get('/promoter/brokerages', params)
}
export function depositToPoint(params = {}) {
return req.post('/deposit/to/point', params)
}
export function pointDraw(params = {}) {
return req.get('/promotion/luckydraw', params)
}
export function pointDrawRule() {
return req.get('/promotion/luckyrules')
}
export function pointDrawSwiper() {
return req.get('/promotion/luckydraw_show')
}
export function pointDrawDetail(luckydraw_id) {
return req.get(`/promotion/luckydraw/${luckydraw_id}`)
}
export function pointDrawIntro(item_id) {
return req.get(`/goods/itemintro/${item_id}`)
}
export function pointDrawPay(params = {}) {
return req.post('/promotion/luckydraworder', params)
}
export function pointDrawPayList(params = {}) {
return req.get('/promotion/luckydraw/joinactivitys', params)
}
export function pointDrawLuck(params = {}) {
return req.get('/promotion/luckydrawmember', params)
}
export function pointOrderDetail(luckydraw_trade_id) {
return req.get(`/promotion/member/luckydraworder/${luckydraw_trade_id}`)
}
export function pointOrderAddress(params = {}) {
return req.post('/promotion/member/luckyaddress', params)
}
export function pointOrderConfirm(params = {}) {
return req.post('/promotion/member/luckyorderfinish', params)
}
export function pointDrawLuckAll() {
return req.get(`/promotion/luckydrawmember`)
}
export function pointMyOrder(params = {}) {
return req.get(`/promotion/luckydrawjoinlist`, params)
}
export function pointAllOrder(luckydraw_id, params = {}) {
return req.get(`/promotion/luckydraw/alljoinlist/${luckydraw_id}`, params)
}
export function pointCompute(luckydraw_id) {
return req.get(`/promotion/luckydraw/winning/${luckydraw_id}`)
}
export function pointCheckLucky(luckydraw_id) {
return req.get(`/promotion/luckydraw/checkwinning/${luckydraw_id}`)
}
export function pointComputeResult(luckydraw_id) {
return req.get(`/promotion/luckydraw/luckylogic/${luckydraw_id}`)
}
export function storeFav(id) {
return req.post(`/member/collect/distribution/${id}`)
}
export function storeFavDel(id) {
return req.delete('/member/collect/distribution', { distributor_id: id })
}
export function storeFavList() {
return req.get('/member/collect/distribution')
}
export function storeFavCount(params = {}) {
return req.get('/member/collect/distribution/num', params)
}
export function storeIsFav(id) {
return req.get('/member/collect/distribution/check', { distributor_id: id })
}
export function receiveVip() {
return req.get('/promotion/getMemberCard')
}
// 获取导购信息
export function getSalesperson(params = {}) {
return req.get('/salesperson', params)
}
// 获取导购投诉列表
export function getComplaintsList(params = {}) {
return req.get('/salesperson/complaintsList', params)
}
// 导购投诉
export function setComplaints(params = {}) {
return req.post('/salesperson/complaints', params)
}
// 获取导购投诉详情
export function getComplaintsDetail(id, params = {}) {
return req.get(`/salesperson/complaintsDetail/${id}`, params)
}
// 获取导购
export function getUsersalespersonrel(params = {}) {
return req.get('/usersalespersonrel', params)
}
// 绑定导购
export function setUsersalespersonrel(params = {}) {
return req.post('/usersalespersonrel', params)
}
// 获取积分列表
export function getPointList(params = {}) {
return req.get('/member/pointLogList', params)
}
//
export function getSalespersonNologin(params = {}) {
return req.get('/salesperson/nologin', params)
}
//
export function getUserNewGetCardDetail(params = {}) {
return req.get('/user/newGetCardDetail', params)
}
// 经销商入驻申请
export function hfpayApplySave(params = {}) {
return req.post('/hfpay/applysave', params)
}
// 经销商入驻详情
export function hfpayUserApply(params = {}) {
return req.get('/hfpay/userapply', params)
}
// 绑定银行卡
export function hfpayBankSave(params = {}) {
return req.post('/hfpay/banksave', params)
}
// 获取绑定银行卡
export function hfpayBankInfo(params = {}) {
return req.get('/hfpay/bankinfo', params)
}
// 获取获取支付方式
export function getTradePaymentList(params = {}) {
return req.get('/trade/payment/list', params)
}
// 获取新的支付方式
export function getNewTradePaymentList(params = {}) {
return req.get('/trade/withdraw/list', params)
}
export function getIsHf(params = {}) {
return req.get('/trade/payment/hfpayversionstatus', params)
}
//获取是否开启获取crm地址
export function getCrmsetting() {
return req.get('/member/crmsetting')
}
// 配置地址
export function getSettingCenter() {
return req.get(transformPlatformUrl('/alipay/pageparams/setting'), {
template_name: platformTemplateName,
version: 'v1.0.1',
page_name: 'member_center_menu_setting'
})
}
// 获取核销码
export function getQRcode(params) {
return req.get('/user/exchangeCardInfo', params)
}
// 会员等级
export function getMemberCard() {
return req.get('/membercard/grades')
}
// 会员中心分享配置
export function getMemberShareConfig() {
return req.get('/memberCenterShare/getInfo')
}
export function is_admin(params) {
return req.get('/distributor/bind/checkout', params)
}

50
src/api/merchant.js Executable file
View File

@ -0,0 +1,50 @@
import req from './req'
//商户类型列表
export function type_list (params) {
return req.get('/merchant/type/list', params)
}
//结算银行列表
export function bank_list (params) {
return req.get('/adapay/bank/list', params)
}
//商户登陆
export function login (params) {
return req.post('/merchant/login', params)
}
//获取当前进行到哪一步
export function getStep (params) {
return req.get('/merchant/settlementapply/step', params)
}
//保存信息
export function save (params) {
return req.post(`/merchant/settlementapply/${params.step}`, params)
}
//获取基础设置
export function getSetting (params) {
return req.get(`/merchant/basesetting`, params)
}
//获取审核结果
export function getAuditstatus (params) {
return req.get(`/merchant/settlementapply/auditstatus`, params)
}
//重新获取密码
export function getResetPsd () {
return req.post(`/merchant/password/reset`)
}
//获取申请详情
export function detail () {
return req.get(`/merchant/settlementapply/detail`)
}
//获取密码
export function getPassword () {
return req.get(`/merchant/password/reset`)
}

51
src/api/pointitem.js Executable file
View File

@ -0,0 +1,51 @@
/*
* @Author: your name
* @Date: 2021-02-25 14:40:11
* @LastEditTime: 2021-02-25 19:27:19
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /ecshopx-newpc/Users/wujiabao/Desktop/work/ecshopx-vshop/src/api/pointitem.js
*/
import req from './req'
export function search (params = {}) {
// return req.get('/item.search', params)
return req.get('/pointsmall/goods/items', params)
}
//获取商城配置
export function getPointitemSetting (params = {}) {
// return req.get('/item.search', params)
return req.get('/pointsmall/setting', params)
}
//获取分类
export function getPointitemCategory (params = {}) {
// return req.get('/item.search', params)
return req.get('/pointsmall/goods/category', params)
}
//商品详情
export function detail (item_id, params = {}) {
return req.get(`/pointsmall/goods/items/${item_id}`, params)
}
//猜你喜欢
export function likeList (params) {
return req.get(`/pointsmall/lovely/goods/items`, params)
}
// 获取积分规则
export function getPointSetting (params = {}) {
return req.get('/point/rule', params)
}
// 获取会员积分信息
export function getMypoint (params = {}) {
return req.get('/point/member/info', params)
}
// 获取会员积分记录列表
export function getMemberPointList (params = {}) {
return req.get('/point/member', params)
}

19
src/api/promotion.js Executable file
View File

@ -0,0 +1,19 @@
import req from './req'
export function automatic (params = {}) {
return req.get('/promotion/register', params)
}
export function getpluspriceList (params = {}) {
return req.get('/promotion/pluspricebuy/getItemList', params)
}
// 开屏广告
export function getScreenAd (params = {}) {
return req.get('/openscreenad', params)
}
//增加扫码日志
export function logQrcode (params) {
return req.post('/promoter/qrcode/log', params)
}

16
src/api/purchase.js Executable file
View File

@ -0,0 +1,16 @@
import req from './req'
// 获取进行中员工内购详情
export function purchaseInfo(params = {}) {
return req.get('/promotion/employeepurchase/getinfo', params)
}
// 员工内购绑定成为家属
export function purchaseBind(params = {}) {
return req.post(`/promotion/employeepurchase/dependents`, params)
}
// 获取员工内购分享码
export function purchaseCode(params = {}) {
return req.get('/promotion/employeepurchase/sharecode', params)
}

7
src/api/region.js Executable file
View File

@ -0,0 +1,7 @@
import req from './req'
export function list () {
req.get('/region.json')
}
export default {}

400
src/api/req-dianwu.js Executable file
View File

@ -0,0 +1,400 @@
import Taro, { getCurrentInstance } from '@tarojs/taro'
import qs from 'qs'
import S from '@/spx'
import {
isAlipay,
isWeixin,
isWeb,
isMerchantModule,
isGoodsShelves,
getExtConfigData,
VERSION_IN_PURCHASE
} from '@/utils'
import { SG_DIANWU_TOKEN } from '@/consts'
import log from '@/utils/log'
import { HTTP_STATUS } from './consts'
function addQuery(url, query) {
return url + (url.indexOf('?') >= 0 ? '&' : '?') + query
}
const request = (() => {
if (isWeb) {
// h5环境请求失败时需要额外处理
return async (...args) => {
let res
try {
res = await Taro.request(...args)
} catch (e) {
res = e
if (e instanceof global.Response) {
const data = await e.json()
res = {
data,
statusCode: e.status,
header: e.headers
}
}
}
return res
}
}
return Taro.request
})()
class RequestQueue {
constructor() {
this.requestList = []
this.isRunning = false
}
push(req) {
this.requestList.push(req)
}
destroy() {
this.isRunning = false
this.requestList = []
}
run() {
this.isRunning = true
const next = async () => {
const req = this.requestList.shift()
log.debug(`requestQueue length is ${this.requestList.length}`)
if (!req) return
await req()
if (this.requestList.length > 0 && this.isRunning) {
await next()
}
}
next()
}
}
class API {
constructor(options = {}) {
this.setOptions(options)
this.isRefreshingToken = false
this.requestQueue = new RequestQueue()
}
setOptions(opts) {
let { baseURL = '/' } = opts
if (!/\/$/.test(baseURL)) {
baseURL = baseURL + '/'
}
this.baseURL = baseURL
const options = {
company_id: process.env.APP_COMPANY_ID
}
if (isWeixin || isAlipay) {
const extConfig = getExtConfigData()
options.appid = extConfig.appid
if (extConfig.company_id) {
options.company_id = extConfig.company_id
}
}
this.options = options
}
errorToast(data) {
let errMsg = data.message || (data.data && data.data.message) || '操作失败,请稍后重试'
if (errMsg.length > 11) {
errMsg = errMsg.substring(0, 11) + '\n' + errMsg.substring(11)
}
setTimeout(() => {
Taro.showToast({
icon: 'none',
title: errMsg
})
}, 200)
}
getReqUrl(url) {
return /^http/.test(url) ? url : `${this.baseURL}${url.replace(/^\//, '')}`
}
handleLogout() {
this.requestQueue.destroy()
this.isRefreshingToken = false
// S.logout()
setTimeout(() => {
console.log(getCurrentInstance().router)
const { path, params } = getCurrentInstance().router
delete params.$taroTimestamp
const fullPath = Object.keys(params).length > 0 ? `${path}?${qs.stringify(params)}` : path
// let url
// if (isMerchantModule()) {
// url = '/subpages/merchant/login'
// } else if (isGoodsShelves()) {
// url = '/subpages/guide/index'
// } else if (VERSION_IN_PURCHASE){
// url = `/subpages/purchase/member`
// } else {
// url = `/subpages/member/index`
// }
// if(path != url) {
// url = url + `?redirect_url=${encodeURIComponent(fullPath)}`
// Taro.redirectTo({ url })
// }
Taro.redirectTo({ url: '/subpages/member/index' })
}, 300)
}
intereptorReq(params) {
const { url, data, header = {}, method = 'GET' } = params
const { company_id, appid } = this.options
const methodIsGet = method.toLowerCase() === 'get'
const reqUrl = this.getReqUrl(url)
let query = !data || typeof data === 'string' ? qs.parse(data) : data
if (company_id) {
query['company_id'] = company_id
}
if (!methodIsGet) {
header['content-type'] = header['content-type'] || 'application/x-www-form-urlencoded'
}
// const token = S.getAuthToken()
const token = Taro.getStorageSync(SG_DIANWU_TOKEN)
if (token) {
header['Authorization'] = `Bearer ${token}`
}
// 处理版本区分
if (isWeb) {
if (process.env.APP_VUE_SAAS) {
header['origin'] = global.location.host
}
}
if ((isWeixin || isAlipay) && appid) {
header['authorizer-appid'] = appid
}
const config = {
...params,
url: reqUrl,
data: query,
method: method.toUpperCase(),
header: header
}
// 清理请求参数
if (methodIsGet) {
config.url = addQuery(config.url, qs.stringify(config.data))
delete config.data
} else {
config.data = qs.stringify(config.data)
}
const { showError } = query
config['showError'] = showError
return config
}
intereptorRes(res) {
const { data, statusCode, config } = res
const { showError = true } = config
if (statusCode == HTTP_STATUS.SUCCESS) {
const { status_code } = data.data
if (!status_code) {
return data.data
} else {
// status_code 不为0表示有错误
if (showError) {
this.errorToast(data)
}
return Promise.reject(this.reqError(res))
}
}
if (statusCode === HTTP_STATUS.UNAUTHORIZED) {
if ((data.data && data.data.code) === HTTP_STATUS.USER_FORBIDDEN) {
if (showError) {
this.errorToast(data)
}
return Promise.reject(this.reqError(res, '帐号已被禁用'))
}
this.handleLogout()
return Promise.reject(this.reqError(res))
}
if (statusCode === HTTP_STATUS.NOT_FOUND) {
return Promise.reject(this.reqError(res, '请求资源不存在'))
}
if (statusCode === HTTP_STATUS.BAD_GATEWAY) {
return Promise.reject(this.reqError(res, '服务端出现了问题'))
}
return Promise.reject(this.reqError(res, `API error: ${statusCode}`))
}
async refreshToken() {
this.isRefreshingToken = true
// const token = S.getAuthToken()
const token = Taro.getStorageSync(SG_DIANWU_TOKEN)
try {
await this.makeReq(
{
header: {
Authorization: `Bearer ${token}`
},
method: 'get',
url: this.getReqUrl('/token/refresh'),
noPending: true
},
(res) => {
console.log('refreshing token: ', res)
const { statusCode } = res
if (statusCode === HTTP_STATUS.UNAUTHORIZED) {
return this.handleLogout()
}
const newToken = res.header.Authorization.split(' ')[1]
S.setAuthToken(newToken)
}
)
} catch (e) {
console.log(e)
}
this.isRefreshingToken = false
}
request = request
/**
*
*
* @param {Object} config 请求参数
* @param {function(Object)} [intereptorRes] 处理请求回调数据的方法
* @param {function(Object)} [intereptorReq] 处理请求参数的方法
* @return {Object} 请求返回的数据
* @memberof API
*/
async makeReq(config = {}, intereptorRes, intereptorReq) {
const { showLoading } = config
const options = intereptorReq ? intereptorReq(config) : this.intereptorReq(config)
if (showLoading) {
Taro.showLoading({
mask: true
})
}
let ret
try {
const res = await this.request(options)
res.config = options
const token = Taro.getStorageSync(SG_DIANWU_TOKEN)
if (
res.statusCode === HTTP_STATUS.UNAUTHORIZED &&
(res.data.data && res.data.data.status_code) === HTTP_STATUS.TOKEN_NEEDS_REFRESH && token
// S.getAuthToken()
) {
// token失效时重造请求并刷新token
if (!this.isRefreshingToken) {
await this.refreshToken()
}
ret = await this.pendingReq(config, intereptorRes, intereptorReq, true)
} else {
if (!this.isRefreshingToken || config.noPending) {
ret = intereptorRes ? intereptorRes(res) : this.intereptorRes(res)
} else {
// 正在刷新token将请求放入队列
ret = await this.pendingReq(config, intereptorRes, intereptorReq)
}
}
} catch (e) {
console.log(e)
}
if (showLoading) {
Taro.hideLoading()
}
return ret
}
pendingReq(config, intereptorRes, intereptorReq, isSend) {
return new Promise((resolve) => {
const pendingReq = async () => {
// 仅加入队列一次
const reqConfig = {
...config,
noPending: true
}
const data = await this.makeReq(reqConfig, intereptorRes, intereptorReq)
resolve(data)
}
this.requestQueue.push(pendingReq)
if (isSend) this.requestQueue.run()
})
}
get(url, data, config) {
return this.makeReq({
...config,
url,
data,
method: 'GET'
})
}
reqError(res, msg = '') {
const errMsg = (res.data && res.data?.data?.message) || msg
const err = new Error(errMsg)
err.res = res
return err
}
post(url, data, config) {
return this.makeReq({
...config,
url,
data,
method: 'POST'
})
}
put(url, data, config) {
return this.makeReq({
...config,
url,
data,
method: 'PUT'
})
}
delete(url, data, config) {
return this.makeReq({
...config,
url,
data,
method: 'DELETE'
})
}
}
if (process.env.NODE_ENV === 'production' && !isWeb) {
Taro.addInterceptor(Taro.interceptors.logInterceptor)
}
console.log('xxxx:', process.env.APP_BASE_URL.replace('/h5app/wxapp', ''))
export default new API({
baseURL: process.env.APP_BASE_URL.replace('/h5app/wxapp', '')
})
export { API }

413
src/api/req.js Executable file
View File

@ -0,0 +1,413 @@
import Taro, { getCurrentInstance } from '@tarojs/taro'
import qs from 'qs'
import S from '@/spx'
import {
isAlipay,
isWeixin,
isWeb,
isMerchantModule,
isGoodsShelves,
getExtConfigData,
VERSION_IN_PURCHASE
} from '@/utils'
import log from '@/utils/log'
import { HTTP_STATUS } from './consts'
function addQuery(url, query) {
return url + (url.indexOf('?') >= 0 ? '&' : '?') + query
}
const request = (() => {
if (isWeb) {
// h5环境请求失败时需要额外处理
return async (...args) => {
let res
try {
res = await Taro.request(...args)
} catch (e) {
res = e
if (e instanceof global.Response) {
const data = await e.json()
res = {
data,
statusCode: e.status,
header: e.headers
}
}
}
return res
}
}
// 支付宝小程序,请求失败时,需要额外处理
if(isAlipay){
return async (...args) => {
let res
try {
res = await Taro.request(...args)
} catch (e) {
res = {
data: e.data,
statusCode: e.status,
header: e.headers
}
}
return res
}
}
return Taro.request
})()
class RequestQueue {
constructor() {
this.requestList = []
this.isRunning = false
}
push(req) {
this.requestList.push(req)
}
destroy() {
this.isRunning = false
this.requestList = []
}
run() {
this.isRunning = true
const next = async () => {
const req = this.requestList.shift()
log.debug(`requestQueue length is ${this.requestList.length}`)
if (!req) return
await req()
if (this.requestList.length > 0 && this.isRunning) {
await next()
}
}
next()
}
}
class API {
constructor(options = {}) {
this.setOptions(options)
this.isRefreshingToken = false
this.requestQueue = new RequestQueue()
}
setOptions(opts) {
let { baseURL = '/' } = opts
if (!/\/$/.test(baseURL)) {
baseURL = baseURL + '/'
}
this.baseURL = baseURL
const options = {
company_id: process.env.APP_COMPANY_ID
}
if (isWeixin) {
const extConfig = getExtConfigData()
options.appid = extConfig.appid
if (extConfig.company_id) {
options.company_id = extConfig.company_id
}
}
this.options = options
}
errorToast(data) {
let errMsg = data.message || (data.data && data.data.message) || '操作失败,请稍后重试'
if (errMsg.length > 11) {
errMsg = errMsg.substring(0, 11) + '\n' + errMsg.substring(11)
}
setTimeout(() => {
Taro.showToast({
icon: 'none',
title: errMsg
})
}, 200)
}
getReqUrl(url) {
return /^http/.test(url) ? url : `${this.baseURL}${url.replace(/^\//, '')}`
}
handleLogout() {
this.requestQueue.destroy()
this.isRefreshingToken = false
S.logout()
setTimeout(() => {
console.log(getCurrentInstance().router)
const { path, params } = getCurrentInstance().router
delete params.$taroTimestamp
const fullPath = Object.keys(params).length > 0 ? `${path}?${qs.stringify(params)}` : path
let url
if (isMerchantModule()) {
url = '/subpages/merchant/login'
} else if (isGoodsShelves()) {
url = '/subpages/guide/index'
} else if (VERSION_IN_PURCHASE){
url = `/subpages/purchase/member`
} else {
url = `/subpages/member/index`
}
if(path != url) {
url = url + `?redirect_url=${encodeURIComponent(fullPath)}`
Taro.redirectTo({ url })
}
}, 300)
}
intereptorReq(params) {
const { url, data, header = {}, method = 'GET' } = params
const { company_id, appid } = this.options
const methodIsGet = method.toLowerCase() === 'get'
const reqUrl = this.getReqUrl(url)
let query = !data || typeof data === 'string' ? qs.parse(data) : data
if (company_id) {
query['company_id'] = company_id
}
if (!methodIsGet) {
header['content-type'] = header['content-type'] || 'application/x-www-form-urlencoded'
}
const token = S.getAuthToken()
if (token) {
header['Authorization'] = `Bearer ${token}`
}
// 处理版本区分
if (isWeb) {
if (process.env.APP_VUE_SAAS) {
header['origin'] = global.location.host
}
}
if ((isWeixin || isAlipay) && appid) {
header['authorizer-appid'] = appid
}
const config = {
...params,
url: reqUrl,
data: query,
method: method.toUpperCase(),
header: header
}
// 清理请求参数
if (methodIsGet) {
config.url = addQuery(config.url, qs.stringify(config.data))
delete config.data
} else {
config.data = qs.stringify(config.data)
}
const { showError } = query
config['showError'] = showError
return config
}
intereptorRes(res) {
const { data, statusCode, config } = res
const { showError = true } = config
if (statusCode == HTTP_STATUS.SUCCESS) {
const { status_code } = data.data
if (!status_code) {
return data.data
} else {
// status_code 不为0表示有错误
if (showError) {
this.errorToast(data)
}
return Promise.reject(this.reqError(res))
}
}
if (statusCode === HTTP_STATUS.UNAUTHORIZED) {
if ((data.data && data.data.code) === HTTP_STATUS.USER_FORBIDDEN) {
if (showError) {
this.errorToast(data)
}
return Promise.reject(this.reqError(res, '帐号已被禁用'))
}
this.handleLogout()
return Promise.reject(this.reqError(res))
}
if (statusCode === HTTP_STATUS.NOT_FOUND) {
return Promise.reject(this.reqError(res, '请求资源不存在'))
}
if (statusCode === HTTP_STATUS.BAD_GATEWAY) {
return Promise.reject(this.reqError(res, '服务端出现了问题'))
}
return Promise.reject(this.reqError(res, `API error: ${statusCode}`))
}
async refreshToken() {
this.isRefreshingToken = true
const token = S.getAuthToken()
console.log('refreshToken',66);
try {
await this.makeReq(
{
header: {
Authorization: `Bearer ${token}`
},
method: 'get',
url: this.getReqUrl('/token/refresh'),
noPending: true
},
(res) => {
console.log('refreshing token: ', res)
const { statusCode } = res
if (statusCode === HTTP_STATUS.UNAUTHORIZED) {
return this.handleLogout()
}
const newToken = res.header.Authorization.split(' ')[1]
S.setAuthToken(newToken)
}
)
} catch (e) {
console.log(e)
}
this.isRefreshingToken = false
}
request = request
/**
*
*
* @param {Object} config 请求参数
* @param {function(Object)} [intereptorRes] 处理请求回调数据的方法
* @param {function(Object)} [intereptorReq] 处理请求参数的方法
* @return {Object} 请求返回的数据
* @memberof API
*/
async makeReq(config = {}, intereptorRes, intereptorReq) {
const { showLoading } = config
const options = intereptorReq ? intereptorReq(config) : this.intereptorReq(config)
if (showLoading) {
Taro.showLoading({
mask: true
})
}
let ret
try {
const res = await this.request(options)
res.config = options
if (
res.statusCode === HTTP_STATUS.UNAUTHORIZED &&
(res.data.data && res.data.data.code) === HTTP_STATUS.TOKEN_NEEDS_REFRESH &&
S.getAuthToken()
) {
// token失效时重造请求并刷新token
if (!this.isRefreshingToken) {
await this.refreshToken()
}
ret = await this.pendingReq(config, intereptorRes, intereptorReq, true)
} else {
if (!this.isRefreshingToken || config.noPending) {
ret = intereptorRes ? intereptorRes(res) : this.intereptorRes(res)
} else {
// 正在刷新token将请求放入队列
ret = await this.pendingReq(config, intereptorRes, intereptorReq)
}
}
} catch (e) {
// console.log(5);
console.log(e)
}
if (showLoading) {
Taro.hideLoading()
}
return ret
}
pendingReq(config, intereptorRes, intereptorReq, isSend) {
return new Promise((resolve) => {
const pendingReq = async () => {
// 仅加入队列一次
const reqConfig = {
...config,
noPending: true
}
const data = await this.makeReq(reqConfig, intereptorRes, intereptorReq)
resolve(data)
}
this.requestQueue.push(pendingReq)
if (isSend) this.requestQueue.run()
})
}
get(url, data, config) {
return this.makeReq({
...config,
url,
data,
method: 'GET'
})
}
reqError(res, msg = '') {
const errMsg = (res.data && res.data?.data?.message) || msg
const err = new Error(errMsg)
err.res = res
return err
}
post(url, data, config) {
return this.makeReq({
...config,
url,
data,
method: 'POST'
})
}
put(url, data, config) {
return this.makeReq({
...config,
url,
data,
method: 'PUT'
})
}
delete(url, data, config) {
return this.makeReq({
...config,
url,
data,
method: 'DELETE'
})
}
}
if (process.env.NODE_ENV === 'production' && !isWeb) {
Taro.addInterceptor(Taro.interceptors.logInterceptor)
}
export default new API({
baseURL: process.env.APP_BASE_URL
})
export { API }

9
src/api/seckill.js Executable file
View File

@ -0,0 +1,9 @@
import req from './req'
export function seckillList (params = {}) {
return req.get('/promotion/seckillactivity/getlist', params)
}
export function seckillGoodsList (params = {}) {
return req.get('/promotion/seckillactivity/getinfo', params)
}

107
src/api/shop.js Executable file
View File

@ -0,0 +1,107 @@
import { platformTemplateName, transformPlatformUrl } from '@/utils/platform'
import req from './req'
export function getShop (params = {}) {
return req.get('/distributor/is_valid', params)
}
export function list (params = {}) {
return req.get('/distributor/list', params)
}
export function getStoreStatus (params = {}) {
return req.get('/nostores/getstatus', params)
}
export function getNearbyShop (params) {
return req.get('/distributor/list', params)
}
// 总店店铺信息及协议
export function getStoreBaseInfo (params = {}) {
return req.get('/shops/info', params)
}
// 协议信息获取
export function getRuleInfo (params = {}) {
return req.get('/shops/protocol', params)
}
// 获取总店信息
export function getDefaultShop (params = {}) {
return req.get('/distributor/default', params)
}
// 获取总店信息
export function getHeadquarters (params = {}) {
return req.get('/distributor/self', params)
}
//
export function getPageParamsConfig ({
page_name,
template_name = platformTemplateName,
version = 'v1.0.1'
}) {
return req.get('/pageparams/setting', {
page_name,
template_name,
version
})
}
// 获取tabbars和小程序配置
export function getAppConfig () {
return req.get('/pagestemplate/setInfo')
}
// 获取首页配置
export function homeSetting () {
return req.get('common/setting', {
type: 'frontend'
})
}
/**
* @function APP启动获取全局配置
*/
export function getAppBaseInfo () {
return req.get(`pagestemplate/baseinfo`, {
page_name: 'color_style',
template_name: platformTemplateName,
version: 'v1.0.1'
})
}
/**
* @function 平台首页模版配置
*/
export function getShopTemplate (params) {
return req.get(`/pagestemplate/detail`, {
template_name: 'yykweishop',
weapp_pages: 'index',
...params
})
}
/**
* @function 店铺首页模版配置
*/
export function getStoreShopTemplate (params) {
return req.get(`/pagestemplate/shopDetail`, {
template_name: 'yykweishop',
weapp_pages: 'index',
...params
})
}
// 获取高德地图key
export function getMapKeyDetail (params) {
return req.get('/third_party/map/key', params)
}
// 获取小程序价格配置
export function getAppGoodsPriceSetting() {
return req.get('/setting/itemPrice')
}

5
src/api/track.js Executable file
View File

@ -0,0 +1,5 @@
import req from './req'
export function viewnum (param = {}) {
return req.post('/track/viewnum', {})
}

75
src/api/trade.js Executable file
View File

@ -0,0 +1,75 @@
import req from './req'
export function list (params) {
// return req.get('/trade.list', params)
return req.get('/orders', params)
}
export function detail (tid) {
// return req.get('/trade.get', { tid })
return req.get(`/order/${tid}`)
}
export function create (data) {
// return req.post('/trade.create', data)
return req.post('/order', data)
}
export function confirm (tid) {
return req.post('/order/confirmReceipt', { order_id: tid })
}
export function cancel (data) {
return req.post('/order/cancel', data)
}
export function getCount (params = { order_type: 'normal' }) {
return req.get('/orderscount', params)
}
export function deliveryInfo (order_type, order_id) {
return req.get(`/trackerpull?order_type=${order_type}&order_id=${order_id}`)
}
export function deliveryInfoNew (params) {
return req.get(`/delivery/trackerpull`, params)
}
export function tradeQuery (trade_id) {
return req.get(`/tradequery`, { trade_id })
}
export function imgUpload (params = {}) {
return req.get(`/espier/upload`, params)
}
export function involiceList (params = {}) {
return req.get(`/orders/invoice`, params)
}
export function zitiCode (params = {}) {
return req.get(`/ziticode`, params)
}
export function createOrderRate (params = {}) {
return req.post(`/order/rate/create`, params)
}
export function h5create (data) {
return req.post('/order_new', data)
}
export function tradeSetting (data) {
return req.get('/trade/setting', data)
}
export function deliveryLists (data) {
return req.get('/delivery/lists', data)
}
// 发送验证码
export function sendCode (orderId) {
return req.get(`/pickupcode/${orderId}`)
}
// 绑定订单
export function bindOrder (data) {
return req.post(`/order/bind/${data.order_id}`, data)
}

182
src/api/user.js Executable file
View File

@ -0,0 +1,182 @@
import { isWeixin, getAppId, isAlipay } from '@/utils'
import req from './req'
export function login (data) {
return req.post('/login', data)
}
// 绑定导购
export function bindSaleperson (data) {
return req.post('/member/bindSalesperson', data)
}
// 绑定
export function bind (data) {
return req.post('/member/bind', data)
}
export function logout () {
return req.post('/user.logout')
}
export function refreshToken () {
return req.get('/token/refresh')
}
export function reg (params) {
return req.post('/member', params)
}
//校验验证码
export function checkSmsCode (params) {
return req.post('/member/check_sms_code', params)
}
export function regRule () {
return req.get('/member/agreement')
}
export function regImg (params = {}) {
return req.get('/member/image/code', params)
}
export function regSmsCode (params = {}) {
return req.get('/member/sms/code', params)
}
export function regParam (params) {
return req.get('/member/setting', params)
}
export function info () {
return { data: {} }
// return req.get('/member/setting')
}
export function forgotPwd (params = {}) {
return req.post('/member/reset/password', params)
}
export function checkpclogin (data) {
return req.post('/oauthlogin', data)
}
export function pclogin (data) {
return req.post('/oauth/login/authorize', data)
}
export function reg_pclogin (data) {
return req.post('/member/decryptPhoneOauth', data)
}
export function registrationActivity (data) {
return req.get('/registrationActivity', data)
}
export function registrationSubmit (data) {
return req.post('/registrationSubmit', data)
}
export function registrationRecordList (data) {
return req.get('/registrationRecordList', data)
}
export function registrationRecordInfo (data) {
return req.get('/registrationRecordInfo', data)
}
export function scancodeAddcart (data) {
return req.post('/goods/scancodeAddcart', data)
}
export function newWxaMsgTmpl (params = {}) {
if(isAlipay){
return req.get('/alitemplatemessage', params)
}
return req.get('/newtemplate', params)
}
export function storeReg (data) {
return req.post('/distributor', data)
}
// 客服
export function im (id) {
return req.get(`/im/meiqia/distributor/${id}`)
}
// 客服默认配置
export function imConfig () {
return req.get(`/im/meiqia`)
}
// 客服默认配置
export function echatConfig () {
return req.get(`/im/echat`)
}
// 扫码登录
export function codeAuth (param = {}) {
return req.post('/oauthlogin', param)
}
// 确认登录
export function codeAuthConfirm (param = {}) {
return req.post('/oauth/login/authorize', param)
}
// 订阅到货通知
export function subscribeGoods (item_id, param) {
return req.post(`/member/subscribe/item/${item_id}`, param)
}
// 检测是否订阅
export function isSubscribeGoods (item_id, param) {
return req.get(`/member/item/is_subscribe/${item_id}`, param)
}
// 检测是否可以分享
export function getIsCanShare (param = {}) {
return req.get('/goods/checkshare/items', param)
}
//ba导购端
export function getGuideInfo (params = {}) {
return req.get('/guide/info', params)
}
export function getGuideShops (params = {}) {
return req.get('/guide/shops', params)
}
//获取导购session_key -> 用户登录
export function getQwUserInfo (params = {}) {
return req.post('/workwechatlogin', params)
}
// //导购登录
// export function getGuideShops(params = {}) {
// return req.get("/workwechatlogin", params);
// }
//悦诗风呀 导购登录
// export function prelogin(data) {
// return req.post("/prelogin", data);
// }
//云店-导购登录
// export function prelogin(params = {}) {
// return req.get("/workwechatlogin", params);
// }
//更新用户详情
export function updateUserInfo (params) {
return req.put('/updateWechatUserInfo', {
...params
})
}
//记录导购被访问的UV
export function uniquevisito (params) {
return req.post('/member/salesperson/uniquevisito', {
...params
})
}
// 是否需要开启初次授权填写个人信息
export function getIsMustOauth (params) {
return req.get('/espier/config/request_field_setting', params)
}

34
src/api/vip.js Executable file
View File

@ -0,0 +1,34 @@
import req from './req'
export function getList(params) {
return req.get('/vipgrades/newlist', params)
}
export function charge(params) {
return req.post('/vipgrades/buy', params)
}
export function getUserVipInfo(params) {
return req.get('/vipgrades/uservip', params)
}
/** 券包api */
export function getBindCardList(params) {
return req.get('/user/getBindCardList', params)
}
export function getShowCardPackage(params) {
return req.get('/user/showCardPackage', params)
}
export function getReceiveCardPackage(params) {
return req.post('/user/receiveCardPackage', params)
}
export function getCurrentGradList() {
return req.post('/user/currentGardCardPackage')
}
// export function getMemberCard(){
// return req.get('/membercard')
// }

6
src/api/wgts.js Executable file
View File

@ -0,0 +1,6 @@
import req from './req'
// 获取推荐商家
export function getNearbyShop (params) {
return req.get('/distributor/list', params)
}

15
src/api/wheel.js Executable file
View File

@ -0,0 +1,15 @@
import req from './req'
// 大转盘获取
export function getTurntableconfig (params) {
return req.get('/promotion/turntableconfig', params)
}
export function getTurntable (params = {}) {
return req.get('/promotion/turntable', params)
}
// 登陆赠送抽奖次数
export function getLoginaddtimes (params = {}) {
return req.get('/promotion/loginaddtimes', params)
}

155
src/api/wx.js Executable file
View File

@ -0,0 +1,155 @@
import Taro from '@tarojs/taro'
import { payTypeField, getAppId } from '@/utils'
import req from './req'
export function getOpenid ({ code }) {
return req.get('/oauth/getopenid', { code })
}
export function getredirecturl ({ url }) {
return req.get('/oauth/getredirecturl', { url })
}
export function info (data) {
return req.post('/wx.info', data)
}
export function code (code) {
return req.get('/wx.code', { code })
}
export function getYoushuOpenid (params) {
const appid = getAppId()
return req.post(
'/getopenid',
{
...params,
appid
},
{ showError: false }
)
}
export function userInfo () {
return req.get('/wx.user.info')
}
export function login (params) {
const appid = getAppId()
return req.post(
'/login',
{
appid,
auth_type: 'wxapp',
...params
},
{ showError: false }
)
}
export function newMarketing () {
return req.get('/promotion/getMemberCard')
}
export function newlogin (params) {
const appid = getAppId()
return req.post(
'/new_login',
{
...params,
appid,
auth_type: 'wxapp'
},
{ showError: false }
)
}
export function newloginh5 (params) {
return req.post('/new_login', {
...params,
trustlogin_tag: 'weixin',
version_tag: 'touch'
})
}
export function prelogin (params) {
const appid = getAppId()
return req.post('/prelogin', {
...params,
appid,
auth_type: 'wxapp'
})
}
// export function prelogin (params) {
// const appid = getAppId()
// return req.post('/workwechatlogin', {
// ...params,
// appid,
// auth_type: 'wxapp'
// })
// }
export function decryptPhone (params) {
const appid = getAppId()
return req.get('/member/decryptPhone', {
...params,
appid
})
}
export function shareSetting (params) {
return req.get('/share/setting', {
...params
})
}
export function getWhiteList () {
return req.get('/whitelist/status')
}
// 获取shareid解析
export function getShareId (params) {
return req.get('/getbyshareid', {
...params
})
}
// 任务埋点上报
export function taskReportData (params) {
return req.post('/salesperson/subtask/post', {
...params
})
}
// 互动埋点上报
export function interactiveReportData (params) {
console.log('[触发互动埋点上报]', params)
return req.post('/salesperson/relationshipcontinuity', {
...params
})
}
// 刷新token
export function refreshToken () {
return req.get('/token/refresh')
}
//加载更多商品
export function loadMoreGoods (params) {
return req.get(`/pagestemplate/detail`, {
...params,
...payTypeField
})
}
export function getPrivacyTime (params) {
return req.get(`/shops/protocolUpdateTime`)
}
export function getWxAuth (params) {
return req.get(`/trustlogin/params`, params)
}
export function getIsNew (params) {
return req.post(`/member/is_new`, params)
}

404
src/app.config.js Executable file
View File

@ -0,0 +1,404 @@
const config = {
pages: [
'pages/index', // 首页
'pages/webview', // webview
'pages/category/index', // 分类
'pages/cart/espier-index', // 购物车页面
'pages/cart/espier-checkout', // 结算页面
'pages/cart/cashier-result', // 支付结果页面
// 'pages/cart/cashier-alipay', // 支付宝收银台adapay
'pages/cart/cashier-weapp', // 微信收银台adapay
'pages/home/landing', // 跳转等待页面
'pages/floorguide/index', // 楼层引导页面
'pages/item/list', // 商品列表页面
'pages/item/espier-detail', // 商品详情页面
'pages/article/index', // 文章页面
'pages/recommend/list', // 推荐软文列表
'pages/member/item-fav', // 收藏页面
'pages/custom/custom-page', // 自定义页面
'pages/chat/index', // 客服
// 'pages/liveroom/index' // 直播间页面
],
subPackages: [
// 内购
// {
// root: 'subpages/purchase',
// pages: [
// 'member',
// 'espier-detail',
// 'espier-checkout',
// 'index' // 家属分享
// ]
// },
// 导购货架 guide
// {
// root: 'subpages/guide',
// pages: [
// 'index', // 货架首页
// 'category/index', // 分类页面
// 'item/list', // 商品列表
// 'item/espier-detail', // 商品详情
// 'cart/espier-index', // 购物车
// 'cart/espier-checkout', // 下单结算
// 'coupon-home/index', // 优惠券
// 'recommend/list', // 种草
// 'recommend/detail', // 种草详情
// 'custom/custom-page' // 自定义页面
// ]
// },
// 门店
// {
// root: 'subpages/store',
// pages: [
// 'index', // 店铺首页
// 'brand-info', // 店铺品牌
// 'item-list', // 店铺商品列表
// 'category', // 店铺商品分类
// 'list', // 选择店铺列表
// 'ziti-list', // 自提列表
// 'ziti-picker' // 自提点选择
// ]
// },
// {
// root: 'subpages/ecshopx',
// pages: [
// 'nearly-shop', // 店铺选择
// 'shop-list' // 商家列表
// ]
// },
{
root: 'subpages/member',
pages: [
'index', // 会员中心
'point-detail', // 积分明细
'point-rule', // 积分规则
'member-level', // 会员等级
'user-info' // 个人信息
]
},
{
root: 'subpages/marketing',
pages: [
'coupon', // 优惠券
'coupon-center', // 优惠券
'coupon-record', // 优惠券使用记录
'coupon-picker', // 优惠券选择
'package-list', // 组合优惠
'certification', // 实名认证
'exchange-code', // 兑换券二维码
]
},
// {
// root: 'subpages/dianwu', // 店务端
// pages: [
// 'index', // webview
// 'list', // 商品搜索列表
// 'cashier', // 收银台
// 'checkout', // 结算
// 'change-price', // 结算改价
// 'collection', // 收款
// 'pending-checkout', // 取单
// 'collection-result', // 收款结果
// 'login', // 登录
// 'picker-shop', // 店铺选择
// 'trade/invoice', //开具发票
// 'trade/change-price', // 订单改价
// 'trade/cancel-trade', // 取消订单
// 'trade/sale-after', // 订单售后
// 'trade/result' // 订单操作结果
// ]
// },
// 积分商城
{
root: 'subpages/pointshop',
pages: [
'list', // 积分商品列表
'espier-detail', // 积分商品详情
'espier-checkout' // 积分商品下单
]
},
// {
// root: 'subpages/community',
// pages: [
// 'index', // 社区团购个人中心
// 'group', // 一键开团
// 'itemlist', // 商品选品
// 'picker-community', // 选择社区
// 'community-edit', // 添加社区
// 'order', // 团员订单列表页
// 'order-refund', // 订单退款页
// 'espier-checkout', //结算页
// 'wait-pay', //待支付订单
// 'group-leaderdetail', // 社区团详情页(团长)
// 'group-memberdetail', // 社区团详情页(团员)
// 'order-manage', // 团长订单列表页
// 'activity', // 我的活动
// 'trade/refund', // 团购-售后申请提交页面
// 'trade/refund-detail', // 团购-售后申请提交结果页面
// 'trade/refund-sendback', // 团购-售后填写物流公司页面
// 'trade/split-bagpack', // 团购-分单物流详情页面Ω
// 'trade/delivery-info', // 团购-整单物流详情页面
// 'trade/cancel', // 团购-取消订单页面,
// 'trade/after-sale-detail', // 团购-售后详情页面
// 'boxlist', // 箱数列表
// 'list', // 商品列表
// 'espier-detail', // 商品详情
// 'apply-chief', // 申请团长
// 'chief-licence', // 团长注册协议
// 'commission', // 团长佣金
// 'withdraw', // 团长提现
// 'withdraw-bank', // 提现银行
// 'withdraw-list' // 提现记录
// ]
// },
{
root: 'subpages/trade',
pages: [
'after-sale',
'after-sale-detail',
'logistics-info',
'store-picker'
]
},
{
root: 'subpages/mdugc',
pages: [
'index',
'list',
'note',
'note-detail',
'subject-talk',
'item-list',
'image-edit',
'my',
'follow-fans',
'info-notify'
// "pages/make_label/index",
// "pages/make_word/index",
// "pages/make_details/index2",
// "pages/make_newslist/index2",
// "pages/make_fabulous/index",
// "pages/make_comment/index",
// "pages/make_follow/index",
// "pages/make_collection/index",
// "pages/make_system/index",
]
},
{
root: 'marketing',
pages: [
// 'pages/distribution/index', // 推广管理首页
// 'pages/distribution/setting', // 推广管理会员资料
// 'pages/distribution/shop-home', // 小店首页
// 'pages/distribution/statistics', // 推广费详情页面
// 'pages/distribution/trade', // 推广订单列表
// 'pages/distribution/subordinate', // 我的会员列表
// 'pages/distribution/withdraw', // 提现页面
// 'pages/distribution/withdrawals-record', // 提现记录
// 'pages/distribution/withdrawals-acount', // 提现绑定账户
// 'pages/distribution/goods', // 推广商品列表
// 'pages/distribution/shop', // 我的小店概览页面
// 'pages/distribution/shop-setting', // 小店设置页面
// 'pages/distribution/shop-form', // 小店设置编辑页面
// 'pages/distribution/qrcode', // 小店二维码
// 'pages/distribution/shop-category', // 小店商品分类
// 'pages/distribution/good-category', // 推广商品分类页面
// 'pages/distribution/shop-goods', // 小店商品页面
// 'pages/distribution/shop-trade', // 小店订单页面
// 'pages/distribution/shop-achievement', // 小店业绩页面
'pages/distribution/point-platform',
'pages/verified-card/index', // 实名认证以及绑定银行卡页面
'pages/verified-card/verified', // 实名认证页面
'pages/verified-card/card', // 绑定银行卡页面
'pages/reservation/brand-list', // 预约列表
'pages/reservation/brand-detail', // 预约详情
'pages/reservation/brand-result', // 预约结果
'pages/reservation/reservation-list', // 预约(代码逻辑显示)
'pages/reservation/goods-reservate', // 预约报名
'pages/reservation/reservation-detail', // 预约详情
'pages/member/item-activity', // 活动列表
'pages/member/activity-detail', // 活动详情
'pages/member/user-info', // 用户注册
'pages/member/complaint', // 投诉导购
'pages/member/complaint-record', // 投诉导购记录
// 'pages/member/coupon', // 我的优惠券列表
// 'pages/member/coupon-detail', // 我的优惠券详情
'pages/member/address', // 我的地址
'pages/member/edit-address', // 编辑地址
'pages/member/crm-address-list', // 收货地址
'pages/member/setting', // 设置页面
// 'pages/member/userinfo', // 用户信息
'pages/member/item-history', // 浏览记录
'pages/member/item-guess', // 猜你喜欢页面
'pages/member/member-code', // 用户二维码
'pages/member/group-list', // 我的拼团
'pages/member/member-setting', // 会员中心设置
'pages/member/destroy-member', // 会员注销页面
'pages/wheel/index', // 大转盘
'pages/item/espier-evaluation', // 商品评论列表
'pages/item/espier-evaluation-detail', // 商品评论详情
'pages/item/rate', //订单评价
'pages/item/success', //评价结果
'pages/item/seckill-goods-list', //秒杀商品列表
'pages/item/seckill-list', //秒杀列表
'pages/item/group-detail', //限时团购详情
'pages/item/group-list', //限时团购列表
'pages/plusprice/detail-plusprice-list', //商品进入换购详情页面
'pages/plusprice/cart-plusprice-list', //购物车进入换购详情页面
]
},
{
root: 'subpage',
pages: [
'pages/recommend/detail', //软文详情页面
'pages/trade/list', //我的订单列表页面
'pages/trade/customer-pickup-list', //我的自提订单列表
'pages/trade/drug-list', //处方药订单列表
'pages/trade/detail', //订单详情页面
'pages/trade/after-sale-detail', //售后详情页面
'pages/trade/delivery-info', //整单物流详情页面
'pages/trade/split-bagpack', //分单物流详情页面Ω
'pages/trade/rate', //订单评价页面
'pages/trade/cancel', //取消订单页面
'pages/trade/after-sale', //售后订单列表
'pages/trade/refund', //售后申请提交页面
'pages/trade/refund-detail', //售后申请提交结果页面
'pages/trade/refund-sendback', //售后填写物流公司页面
'pages/trade/invoice-list', //发票管理
// 'pages/cashier/index', //收银台页面
// 'pages/cashier/cashier-result', //支付结果页面
'pages/qrcode-buy', //二维码购买页
'pages/vip/vipgrades', //会员购买页面
'pages/auth/pclogin', //pc登录页面
// 编辑分享
'pages/editShare/index'
]
},
// // 助力
// {
// root: 'boost',
// pages: [
// 'pages/home/index',
// 'pages/detail/index',
// 'pages/flop/index',
// 'pages/pay/index',
// 'pages/payDetail/index',
// 'pages/order/index'
// ]
// },
// {
// root: 'others',
// pages: [
// 'pages/home/license',
// // 'pages/home/coupon-home',
// 'pages/protocol/privacy',
// // 美恰客服
// 'pages/meiqia/index',
// 'pages/echat/index',
// // 扫码授权登录
// 'pages/auth/index',
// // 储值
// 'pages/recharge/index',
// 'pages/recharge/history',
// // cart
// // 'pages/cart/coupon-picker',
// 'pages/cart/drug-info',
// // 绑定订单
// 'pages/bindOrder/index',
// // 过期优惠券
// // 'pages/nullify/coupon-nullify'
// ]
// },
// 商家入驻
// {
// root: 'subpages/merchant',
// pages: [
// 'login', //登陆页面
// 'apply', //申请页面
// 'selector', //选择页面
// 'audit', //审核页面
// 'agreement' //协议页面
// ]
// },
// 授权
{
root: 'subpages/auth',
pages: [
'reg', //注册页面
'reg-rule', //注册协议页面
'login', //登陆页
'edit-password', //修改密码页面
'bindPhone', //绑定手机页面
'auth-loading', //授权加载页
'forgotpwd', //找回密码页面
'edit-phone' //修改密码页面
]
}
],
permission: {
'scope.userLocation': {
desc: '您的位置信息将用于定位附近门店'
}
},
// usingComponents: {
// 'mp-html': './components/sp-html/mp-weixin/index'
// },
window: {
'backgroundTextStyle': 'dark',
'navigationBarBackgroundColor': '#fff',
'navigationBarTitleText': 'BIRKENSTOCK',
'navigationBarTextStyle': 'black',
'navigationStyle': 'custom',
},
plugins: {
// 'live-player-plugin': {
// 'version': '1.3.0', // 注意填写该直播组件最新版本号,微信开发者工具调试时可获取最新版本号(复制时请去掉注释)
// 'provider': 'wx2b03c6e691cd7370' // 必须填该直播组件appid该示例值即为直播组件appid复制时请去掉注释
// }
},
requiredPrivateInfos: [
"getLocation",
"chooseAddress"
],
"__usePrivacyCheck__": true
}
if (process.env.TARO_ENV == 'weapp') {
Object.assign(config, {
usingComponents: {
'mp-html': './components/sp-html/mp-weixin/index',
"sp-wx-privacy": "./components/sp-wx-privacy/index"
}
})
}
if (process.env.APP_LIVE == 'true') {
Object.assign(config.plugins, {
'live-player-plugin': {
'version': '1.3.0', // 注意填写该直播组件最新版本号,微信开发者工具调试时可获取最新版本号(复制时请去掉注释)
'provider': 'wx2b03c6e691cd7370' // 必须填该直播组件appid该示例值即为直播组件appid复制时请去掉注释
}
})
}
if (process.env.APP_ADAPAY == 'true') {
Object.assign(config.plugins, {
'Adapay': {
'version': 'latest', // 注意填写该直播组件最新版本号,微信开发者工具调试时可获取最新版本号(复制时请去掉注释)
'provider': 'wx308088053f4ecc3a' // 必须填该直播组件appid该示例值即为直播组件appid复制时请去掉注释
}
})
}
export default config

182
src/app.js Executable file
View File

@ -0,0 +1,182 @@
import React, { Component } from 'react'
import Taro, { getCurrentInstance, getCurrentPages } from '@tarojs/taro'
import S from '@/spx'
import { Provider } from 'react-redux'
import configStore from '@/store'
import api from '@/api'
// import { Tracker } from "@/service";
// import { youshuLogin } from '@/utils/youshu'
import { fetchUserFavs } from '@/store/slices/user'
import {
DEFAULT_TABS,
DEFAULT_THEME,
SG_APP_CONFIG,
SG_MEIQIA,
SG_YIQIA,
SG_ROUTER_PARAMS,
SG_GUIDE_PARAMS,
SG_GUIDE_PARAMS_UPDATETIME
} from '@/consts'
import { checkAppVersion, isWeixin, isWeb, isNavbar, log, entryLaunch } from '@/utils'
import { requestIntercept } from '@/plugin/requestIntercept'
import dayjs from 'dayjs'
import './app.scss'
// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释:
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5') {
// require('nerv-devtools')
// }
const { store } = configStore()
// 如果是app模式注入SAPP
if (process.env.APP_BUILD_TARGET == 'app') {
import('@/plugin/app/index').then(({ SAPP }) => {
SAPP.init(Taro, store)
})
} else {
import('@/plugin/routeIntercept').then(({ intercept }) => {
intercept.init()
})
}
requestIntercept()
class App extends Component {
// componentWillMount() {
// this.getSystemConfig()
// // if ( S.getAuthToken() ) {
// // store.dispatch(fetchUserFavs());
// // }
// }
componentDidMount() {
}
onLaunch(options) {
console.log(`app onLaunch:`, options)
import('../package.json').then(res => {
console.log(`App Name: ${res.name}, version: ${res.version}`)
})
}
async componentDidShow(options) {
if (isWeixin) {
checkAppVersion()
}
// isWeb环境下H5启动时路由携带参数在options
// 小程序环境启动时路由携带参数在options.query
entryLaunch.getRouteParams(isWeb ? { query: options } : options).then((params) => {
console.log(`app componentDidShow:`, options, params)
Taro.setStorageSync(SG_ROUTER_PARAMS, params)
// 已缓存的导购参数
const guideParams = Taro.getStorageSync(SG_GUIDE_PARAMS) || {}
const guideUpdateTime = Taro.getStorageSync(SG_GUIDE_PARAMS_UPDATETIME) || ''
const diffMilliseconds = dayjs().diff(dayjs(guideUpdateTime))
// 参数保存超过3天清除导购参数
if (diffMilliseconds > 3 * 86400000) {
Taro.removeStorageSync(SG_GUIDE_PARAMS)
Taro.removeStorageSync(SG_GUIDE_PARAMS_UPDATETIME)
} else {
// 欢迎语携带用户编号
if (guideParams?.gu_user_id) { delete guideParams.gu_user_id }
Taro.setStorageSync(SG_GUIDE_PARAMS, {
...guideParams,
...params
})
Taro.setStorageSync(SG_GUIDE_PARAMS_UPDATETIME, dayjs().unix())
}
// 导购UV上报
if (S.getAuthToken()) {
entryLaunch.postGuideUV()
entryLaunch.postGuideTask()
}
})
const { show_time } = await api.promotion.getScreenAd()
let showAdv
if (show_time === 'always') {
showAdv = false
store.dispatch({
type: 'user/closeAdv', payload: showAdv
})
}
this.getSystemConfig()
}
async getSystemConfig() {
const {
echat,
meiqia,
disk_driver = 'qiniu',
whitelist_status = false,
nostores_status = false,
distributor_param_status = false,
point_rule_name = '积分'
} = await api.shop.homeSetting()
const {
tab_bar,
is_open_recommend: openRecommend,
is_open_scan_qrcode: openScanQrcode,
is_open_wechatapp_location: openLocation,
is_open_official_account: openOfficialAccount,
color_style: { primary, accent, marketing },
title // 商城应用名称
} = await api.shop.getAppBaseInfo()
const priceSetting = await api.shop.getAppGoodsPriceSetting()
Taro.setStorageSync('distributor_param_status', distributor_param_status)
try {
const tabBar = JSON.parse(tab_bar)
store.dispatch({
type: 'sys/setSysConfig',
payload: {
initState: true,
colorPrimary: primary,
colorMarketing: marketing,
colorAccent: accent,
pointName: point_rule_name,
tabbar: tabBar,
openRecommend, // 开启猜你喜欢 1开启 2关闭
openScanQrcode, // 开启扫码功能 1开启 2关闭
openLocation, // 开启小程序定位 1开启 2关闭
openOfficialAccount, // 开启关注公众号组件 1开启 2关闭
diskDriver: disk_driver,
appName: title,
echat,
meiqia,
openStore: !nostores_status, // 前端店铺展示是否关闭 true:开启 false:关闭接口返回值为true:关闭 false:不关闭)
priceSetting
}
})
// 兼容老的主题方式
store.dispatch({
type: 'colors/setColor',
payload: {
primary,
marketing,
accent
}
})
} catch (error) {
console.log(error)
}
}
componentDidCatchError() { }
render() {
return <Provider store={store}>{this.props.children}</Provider>
}
}
export default App

336
src/app.scss Executable file
View File

@ -0,0 +1,336 @@
@import './style/theme.scss';
@import './style/variables.scss';
@import './style/layout.scss';
@import './style/iconfont.scss';
@import './style/iconfont/iconfont.css';
$font-size-base: $font-size;
$hd: 2 !default; //
$color-brand: $color-brand-primary;
$color-brand-light: $color-brand-accent;
$color-brand-dark: $color-brand-accent-light;
$color-text-base: $color-primary-text;
$at-button-border-color-secondary: $color-border-gray;
@import '~taro-ui/dist/style/index.scss';
@import './style/taro-ui-mod.scss';
@import './style/sp-comps.scss';
@import './style/alipay-comps.scss';
body,
view {
font-family: $font-family;
font-size: $font-size;
&::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
}
page,
body {
background: $color-bg-gray;
color: $color-primary-text;
&::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
}
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
body {
position: inherit !important;
}
.taro__modal {
transition: opacity 0s linear 0s !important;
}
#react-refresh-overlay {
display: none;
}
.lnk {
color: $color-link;
}
.lock-screen {
width: 100%;
height: 100%;
position: fixed;
overflow: hidden;
}
.hidden {
display: none !important;
}
.sec {
background: #fff;
margin: 0 0 $edge-margin;
&-hd {
display: flex;
line-height: 1;
align-items: center;
padding: $edge-size;
.more {
color: $color-link;
font-size: $font-size-small;
margin-right: floor(-$edge-size / 4);
}
.at-icon {
font-size: $font-size-large;
}
}
&-title {
flex: 1;
}
&-ft {
color: $color-gray-light;
margin-right: floor(-$edge-size / 4);
.at-font {
font-size: $font-size-large;
}
}
}
.btns {
button,
.at-button {
margin: 0 0 $edge-margin;
}
padding: $edge-margin $edge-size;
}
.page-trade-refund {
.at-tabs__page {
display: none;
}
}
.toolbar {
&.toolbar-inline {
.at-button,
at-button {
width: 100%;
}
}
background: #fff;
font-size: $font-size;
display: flex;
height: $toolbar-height;
box-shadow: $toolbar-shadow;
box-sizing: border-box;
padding: $edge-margin $edge-size;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
align-items: center;
align-content: center;
justify-content: space-between;
z-index: $z-index-toolbar;
.at-button {
font-size: $font-size;
}
&-hd {
}
&-ft {
max-width: 120px;
}
}
switch,
.weui-switch {
transform: scale(0.6);
transform-origin: center right;
}
.search-input__bar {
.at-search-bar {
&__input {
line-height: 30px - 10px;
}
}
}
.AtFlayout {
.layout {
border-radius: 15px 15px 0 0;
}
.layout-body {
background: #efefef;
padding: 0;
border-radius: 15px 15px 0 0;
}
}
// .sp-login {
// .login-btn {
// border-width: 0;
// height: auto;
// line-height: auto;
// padding: 0;
// }
// }
.sp-search-bar {
}
.usericon {
border: 4px solid #fff;
width: 110px;
height: 110px;
border-radius: 50px;
margin-right: 30px;
}
.weui-input {
height: 100%;
}
/* wgt common styles */
.wgt {
&.wgt__padded {
padding: 20px 0px;
}
.wgt-head {
padding: 0px 16px;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
.wgt-hd {
display: flex;
align-items: baseline;
flex: 1;
.wgt-title {
color: #222;
font-size: 36px;
font-weight: bold;
margin-right: 16px;
max-width: 30%;
@include multi-ellipsis(1);
}
}
.wgt-subtitle {
color: #999;
font-size: 28px;
max-width: 55%;
@include multi-ellipsis(1);
}
.wgt-more {
display: flex;
align-items: center;
justify-content: center;
width: 60px;
height: 24px;
border-radius: 60px;
.three-dot {
position: relative;
width: 8px;
height: 8px;
background: #333;
border-radius: 50%;
&::before,
&::after {
position: absolute;
width: 8px;
height: 8px;
background: #333;
border-radius: 50%;
content: '';
}
&::before {
transform: translateX(-160%);
}
&::after {
transform: translateX(160%);
}
}
}
}
// .wgt-body {
// margin-top: 24px;
// }
}
/* coupon styles */
.sp-shop-coupon {
position: relative;
overflow: hidden;
display: inline-block;
&::before {
content: '';
display: block;
width: 22px;
height: 22px;
border-radius: 50%;
background-color: #fff;
position: absolute;
top: 50%;
left: -18px;
transform: translateY(-50%);
/* prettier-ignore */
border: 1PX solid var(--color-primary);
}
&::after {
content: '';
display: block;
width: 22px;
height: 22px;
border-radius: 50%;
background-color: #fff;
position: absolute;
top: 50%;
right: -18px;
transform: translateY(-50%);
/* prettier-ignore */
border: 1PX solid var(--color-primary);
}
.coupon-wrap {
/* prettier-ignore */
border: 1PX solid var(--color-primary);
border-radius: 4px;
height: 40px;
line-height: 38px;
padding: 0 10px;
}
.coupon-text {
color: var(--color-primary);
font-size: 22px;
}
}
.wgt-timer {
.at-countdown__time-box {
font-family: sans-serif;
background: var(--color-primary);
border-radius: 6px;
min-width: 38px;
height: 40px;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 26px;
padding: 0 2px;
}
.time-fonts {
display: inline-flex;
padding-top: 6px;
}
}
// h5
.taro_router {
.taro_page {
background-color: transparent !important;
}
}

BIN
src/assets/chazhao-light.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
src/assets/del-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
src/assets/icon/filter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

BIN
src/assets/icon/sort.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

BIN
src/assets/imgs/bt_scanning.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
src/assets/imgs/buy.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
src/assets/imgs/cart_empty.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/assets/imgs/connect.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
src/assets/imgs/coupons.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
src/assets/imgs/down_icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

BIN
src/assets/imgs/editshare.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 950 B

BIN
src/assets/imgs/group.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
src/assets/imgs/pay_fail.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
src/assets/imgs/pay_success.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/assets/imgs/plane.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
src/assets/imgs/poster.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

BIN
src/assets/imgs/score.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
src/assets/imgs/store.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
src/assets/imgs/svip.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
src/assets/imgs/user-icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
src/assets/imgs/weixin.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/assets/logo-light.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
src/assets/qr-code.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

BIN
src/assets/wchat-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
src/assets/you-light.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

BIN
src/assets/ziliao-light.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

BIN
src/boost/assets/icon_3.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,50 @@
import React, { Component } from 'react'
import Taro, { getCurrentInstance } from '@tarojs/taro'
import { View, Image, Text, Button, Progress } from '@tarojs/components'
import './index.scss'
export default class BargainItem extends Component {
static defaultProps = {
info: {}
}
constructor (props) {
super(props)
}
handleItem = () => {
const { info } = this.props
Taro.navigateTo({
url: `/boost/pages/detail/index?bargain_id=${info.bargain_id}`
})
}
render () {
const { info } = this.props
return (
<View className='bargainItem'>
<Image className='img' src={info.item_pics} mode='aspectFill' />
<View className='info'>
<View className='title'>{info.item_name}</View>
<View className='price'>
<Text className='text'>¥{info.mkt_price}</Text>
<Text className='text diff'>砍价立减¥{info.diff_price}</Text>
</View>
{/* <View className='progress'>
<Progress percent={20} activeColor='#a2564c' backgroundColor='#f0eeed' strokeWidth={6} active />
<View className='interval'>
<Text className='text'>¥{ info.mkt_price }</Text>
<Text className='text'>¥{ info.price }</Text>
</View>
</View> */}
</View>
<View className='act'>
<Button size='mini' className='btn' onClick={this.handleItem.bind(this)}>
查看详情
</Button>
</View>
</View>
)
}
}

Some files were not shown because too many files have changed in this diff Show More