Commit 91dafd68 by 汤强勇

init project

parent 4f5d4804
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
}
}
}
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
/build/
/config/
/dist/
/*.js
/test/unit/coverage/
// https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
],
// required to lint *.vue files
plugins: [
'vue'
],
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}
.DS_Store
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/test/unit/coverage/
/test/e2e/reports/
selenium-debug.log
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')
exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
}
}
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}
return output
}
exports.createNotifierCallback = () => {
const notifier = require('node-notifier')
return (severity, errors) => {
if (severity !== 'error') return
const error = errors[0]
const filename = error.file && error.file.split('!').pop()
notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'icon-person.png')
})
}
}
'use strict'
const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
const sourceMapEnabled = isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap
module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
}
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
// const ExtractTextPlugin = require('extract-text-webpack-plugin');
//
// // // 创建多个实例
// const extractCSS = new ExtractTextPlugin('stylesheets/[name]-[contenthash].css');
// const extractLESS = new ExtractTextPlugin('stylesheets/[name]-[contenthash].less.css');
// const extractSASS = new ExtractTextPlugin('stylesheets/[name]-[contenthash].scss.css');
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
const createLintingRule = () => ({
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
options: {
formatter: require('eslint-friendly-formatter'),
emitWarning: !config.dev.showEslintErrorsInOverlay
}
})
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
'assets': resolve('src/assets'),
// 'views': resolve('src/views'),
// 'components': resolve('src/components')
}
},
module: {
rules: [
...(config.dev.useEslint ? [createLintingRule()] : []),
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
},
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
// plugins: [
// new webpack.optimize.CommonsChunkPlugin('common.js'),
// new webpack.ProvidePlugin({
// jQuery: "jquery",
// $: "jquery"
// })
// ]
}
'use strict'
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
const dev = require('../config/dev.env')
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const devWebpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,
// these devServer options should be customized in /config/baseHttp.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': merge(dev, {
host:`'//localhost:${PORT || config.dev.port}/api'`
})
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
]),
new ExtractTextPlugin('css/[name].css?[contenthash]')
]
})
module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port
portfinder.getPort((err, port) => {
if (err) {
reject(err)
} else {
// publish the new Port, necessary for e2e tests
process.env.PORT = port
// add port to devServer config
devWebpackConfig.devServer.port = port
// Add FriendlyErrorsPlugin
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
compilationSuccessInfo: {
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
},
onErrors: config.dev.notifyOnErrors
? utils.createNotifierCallback()
: undefined
}))
resolve(devWebpackConfig)
}
})
})
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = process.env.NODE_ENV === 'testing'
? require('../config/test.env')
: require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true,
usePostCSS: true
})
},
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: path.resolve(__dirname, `../dist/${env.baseUrl.replace(/['"]/g,"")}/${env.url.replace(/['"]/g,"")}`),//config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
publicPath:['',env.baseUrl.replace(/['"]/g,""),env.url.replace(/['"]/g,""),''].join('/'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
drop_console:true,
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: process.env.NODE_ENV === 'testing'
? 'index.html'
: path.resolve(__dirname, `../dist/${env.baseUrl.replace(/['"]/g,"")}/${env.url.replace(/['"]/g,"")}/index.html`),
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig
module.exports = {
"preProduct": {
"host":"//10.0.16.179:8080",
"url":"minapro",
"baseUrl":"vue"
},
"product": {
"host":"//wxapp.hotwind.net",
"baseUrl":"vue",
"url":"minapro"
},
"devProduct": {
"host":"//wxapp.hotwind.net",
"baseUrl":"vue",
"url":"mina"
}
}
module.exports = {
config: [{
project: '',
requestUrl: ''
}]
}
\ No newline at end of file
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
const configRequest = require('./config.request')
module.exports = merge(prodEnv, {
'NODE_ENV': "'development'",
'host': "'//localhost'",
'url': "''",
'baseUrl': "''"
})
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api': {
target: '', // 接口的域名
// secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
pathRewrite: {
'^/api': ''
}
}
},
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
// Use Eslint Loader?
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
useEslint: true,
// If true, eslint errors and warnings will also be shown in the error overlay
// in the browser.
showEslintErrorsInOverlay: false,
/**
* Source Maps
*/
// https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map',
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,
cssSourceMap: true
},
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
// assetsPublicPath: '/minapro/vue/', // '/minapro/vue/'
assetsPublicPath: '',
/**
* Source Maps
*/
productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}
module.exports = {
"host":"'//wxapp.hotwind.net'",
"baseUrl":"'mina'",
"url":"'vue'"
}
'use strict'
const configRequest = require('./config.request')
const yargs = require('yargs').argv
const env = yargs.env
let path = './prod.prod.env'
if (env === 'dev') {
path = './prod.dev.env'
} else if (env === 'uat') {
path = './prod.uat.env'
}
const envConfig = require(path)
module.exports = {
NODE_ENV: '"production"',
configRequest: JSON.stringify(configRequest),
...envConfig
}
module.exports = {
"host": "''",
"project": "''",
"requestUrl": "''"
}
module.exports = {
"host":"'//10.0.16.179:8080'",
"url":"'vue'",
"baseUrl":"'minapro'"
}
'use strict'
const merge = require('webpack-merge')
const devEnv = require('./dev.env')
module.exports = merge(devEnv, {
NODE_ENV: '"testing"'
})
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>热风断码调货小程序后台管理系统</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
{
"name": "hotwind-manage",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "汤强勇 <tangqy@bigaka.com>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
"lint:fix": "eslint --ext .js,.vue src test/unit test/e2e/specs --fix",
"build:dev": "node build/build.js --env=dev",
"build:uat": "node build/build.js --env=uat",
"build": "node build/build.js --env=prod"
},
"dependencies": {
"axios": "^0.18.0",
"es6-promise": "^4.2.4",
"moment": "^2.22.2",
"ramda": "^0.25.0",
"rxjs": "^6.2.1",
"underscore": "^1.9.1",
"validate": "^4.4.1",
"vee-validate": "^2.0.9",
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vue-rx": "^6.0.0",
"vuex": "^3.0.1",
"vuex-router-sync": "^5.0.0"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^8.2.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-jest": "^21.0.2",
"babel-loader": "^7.1.1",
"babel-plugin-component": "^1.1.1",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"chromedriver": "^2.27.2",
"copy-webpack-plugin": "^4.0.1",
"cross-spawn": "^5.0.1",
"css-loader": "^0.28.11",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"jest": "^22.0.4",
"jest-serializer-vue": "^0.3.0",
"json5-loader": "^1.0.1",
"less": "^3.0.4",
"less-loader": "^4.1.0",
"nightwatch": "^0.9.12",
"node-notifier": "^5.1.2",
"node-sass": "^4.9.0",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"sass-loader": "^7.0.3",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"style-loader": "^0.21.0",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-jest": "^1.0.2",
"vue-loader": "^13.3.0",
"vue-style-loader": "^4.1.0",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0",
"yargs": "^12.0.1"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
\ No newline at end of file
# hotwind-manage
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
# run unit tests
npm run unit
# run e2e tests
npm run e2e
# run all tests
npm test
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
<template>
<div id="app">
app work!!!
<transition name="bounce">
<keep-alive>
<router-view></router-view>
</keep-alive>
</transition>
</div>
</template>
<style lang="scss">
@import "~@/assets/scss/main";
</style>
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
<template>
<div class="hello">
<h1>{{ msg }}{{count}}</h1>
<h2>Essential Links</h2>
</div>
</template>
<script>
// import { Observable, Subject, asapScheduler, pipe, of, from, interval, merge, fromEvent } from 'rxjs';
// import { map, filter, scan } from 'rxjs/operators';
// import { webSocket } from 'rxjs/webSocket';
// import { ajax } from 'rxjs/ajax';
// import { TestScheduler } from 'rxjs/testing';
import { merge } from 'rxjs'
import { map, startWith, scan } from 'rxjs/operators'
export default {
name: 'HelloWorld',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
},
// declare the receiving Subjects
domStreams: ['plus$', 'minus$'],
subscriptions () {
// ...then create subscriptions using the Subjects as source stream.
// the source stream emits in the format of `{ event: HTMLEvent, data?: any }`
return {
count: merge(
this.plus$.pipe(map(() => 1)),
this.minus$.pipe(map(() => -1))
).pipe(
startWith(0),
scan((total, change) => total + change)
)
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
<template>
<div class="breadcrumb">
<el-row>
<el-col class="nav" :span="24">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item
:key="key"
v-for=" (value , key) in breadcrumbItems"
>{{ value }}</el-breadcrumb-item>
</el-breadcrumb>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
name: 'breadcrumb',
data () {
return {
}
},
created () {
},
computed: {
router () {
this.breadcrumbItems()
return this.$store.state.route
},
breadcrumbItems () {
let o = {}
this.$route.matched.map((item) => {
if (item.meta.title) {
const name = item.name
const title = item.meta.title
o[name] = title
}
})
return o
}
}
}
</script>
<style scoped>
.nav {
padding: 15px;
background: #f5f5f5;
}
</style>
import {
orderStatus as orderMixin,
logistics as logisticsMixin,
format,
calcPrice
} from './order'
export {
orderMixin,
format,
logisticsMixin,
calcPrice
}
export default {
methods: {
/**
* 计算选择的商品优惠价格
* @param activitys 商品
* @returns {*} 商品价格
*/
calcActivityPrice (activitys) {
activitys = activitys || []
return activitys.reduce((total, item) => {
const activityPrice = item.activityPrice || 0
total += activityPrice * item.count
return total
}, 0)
},
initSelection (rows) {
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row)
})
} else {
this.$refs.multipleTable.clearSelection()
}
}
}
}
import moment from 'moment'
export default {
methods: {
formatDate (date, format) {
let dateStr = ''
format = format || 'YYYY-MM-DD hh:mm:ss'
if (date) {
dateStr = moment(date).format(format)
}
return dateStr
}
}
}
import orderStatus from './orderStatus'
import logistics from './logistics'
import format from './formatDate'
import calcActivityPrice from './calcActivityPrice'
export {
orderStatus,
format,
logistics,
calcActivityPrice as calcPrice
}
export default {
data () {
return {
showLogisticsInfo: false
}
},
computed: {
expressInfo () {
return this.$store.getters.getExpress
}
},
methods: {
getExpress (order) {
if (!(order.logisticsBillno && order.logisticsCode)) {
return false
}
const params = {
logisticsCode: order.logisticsCode,
logisticsNo: order.logisticsBillno
}
this.$store.dispatch('getExpress', params)
},
showLogistics () {
this.showLogisticsInfo = true
}
}
}
export default {
methods: {
/**
* 获取订单状态
* @param order
* @param isReturnStatus 是否使用订单的returnStatus字段 (目前只有订单详情,订单列表使用returnStatus)
* @returns {string}
*/
orderStatus (order, isReturnStatus) {
// <c:if test="${order.orderStatus ==0 }">已取消</c:if> <c:if
// test="${order.orderStatus ==1 }">待付款</c:if> <c:if
// test="${order.orderStatus ==2 && order.returnStatus != 6}">待发货</c:if> <c:if
// test="${order.orderStatus ==3 && order.returnStatus != 6}">待收货</c:if> <c:if
// test="${order.orderStatus ==4 && order.returnStatus != 6}">已签收</c:if><c:if
// test="${order.returnStatus == 6}">已退款</c:if>
let orderStatus, orderReturnstatus
try {
orderStatus = `${order.orderStatus}`
orderReturnstatus = `${isReturnStatus ? order.returnStatus : order.orderReturnstatus}`
} catch (e) {
console.log(e)
orderStatus = ''
orderReturnstatus = ''
}
let status = ''
if (orderReturnstatus === '6') {
status = '已退款'
} else if (orderStatus === '0') {
status = '已取消'
} else if (orderStatus === '1') {
status = '待付款'
} else if (orderStatus === '2') {
status = '待发货'
} else if (orderStatus === '3') {
status = '待收货'
} else if (orderStatus === '4') {
status = '已签收'
}
// console.log('========== status ==========%o', status)
return status
},
returnOrderStates () {
return {
0: '无退货',
1: '待审核',
2: '待退款',
3: '已驳回',
4: '已取消',
5: '待收货',
6: '已完成',
7: '待退货'
}
},
returnOrderStatus (order, isReturnStatus) {
const status = isReturnStatus ? order.returnStatus : order.orderReturnStatus
const state = this.returnOrderStates()
return state[status]
},
showReTurnBtn (order) {
let showBtn = false
const status = this.orderStatus(order, true)
const state = this.returnOrderStatus(order, true)
if (state === '无退货') {
if (['待发货', '已签收'].indexOf(status) > -1) {
showBtn = true
}
}
return showBtn
}
}
}
<template>
<div>
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'index'
}
</script>
<style scoped>
</style>
<template>
<div class="order">
<section class="form-content">
<el-form :inline="true" :model="formInline" ref="formInline" class="demo-form-inline">
<el-form-item label="订单编号">
<el-input v-model="formInline.orderId" placeholder="请输入订单编号"></el-input>
</el-form-item>
<el-form-item label="订单状态:">
<el-select v-model="formInline.orderStatus" placeholder="请选择订单状态">
<el-option label="全部" value="-1"></el-option>
<el-option label="已取消" value="0"></el-option>
<el-option label="待付款" value="1"></el-option>
<el-option label="待发货" value="2"></el-option>
<el-option label="待收货" value="3"></el-option>
<el-option label="已签收" value="4"></el-option>
<el-option label="已退款" value="14"></el-option>
</el-select>
</el-form-item>
<el-form-item label="会员手机号">
<el-input v-model="formInline.customerMobile" placeholder="请输入会员手机号"></el-input>
</el-form-item>
<el-form-item label="快递单号">
<el-input v-model="formInline.logisticsBillno" placeholder="请输入快递单号"></el-input>
</el-form-item>
<el-form-item label="下单时间">
<el-date-picker
v-model="dateData"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="会员卡号">
<el-input v-model="formInline.custNo" placeholder="请输入会员卡号"></el-input>
</el-form-item>
<el-form-item label="下单门店">
<el-input v-model="formInline.storeName" placeholder="请输入下单门店号"></el-input>
</el-form-item>
<el-form-item label="客服备注">
<el-select v-model="formInline.remark" placeholder="请选择">
<el-option label="有备注" value="1"></el-option>
<el-option label="无备注" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
<el-button @click="resetForm()">重置</el-button>
</el-form-item>
</el-form>
</section>
<el-table
:data="tableData"
style="width: 100%">
<el-table-column
label="订单编号"
width="180">
<template slot-scope="scope">
<span >{{ scope.row.id }}</span>
</template>
</el-table-column>
<el-table-column
label="下单时间"
width="180">
<template slot-scope="scope">
<span >{{ formatDate(scope.row.createTime,'YYYY-MM-DD hh:mm:ss')}}</span>
</template>
</el-table-column>
<el-table-column
label="下单门店"
width="160">
<template slot-scope="scope">
<span >{{ scope.row.storeName }}</span>
</template>
</el-table-column>
<el-table-column
label="会员"
width="120">
<template slot-scope="scope">
<span >{{ scope.row.customerMobile }}</span>
</template>
</el-table-column>
<el-table-column
label="订单金额"
width="100">
<template slot-scope="scope">
<span>{{ scope.row.paidFee }}</span>
</template>
</el-table-column>
<el-table-column
label="微信支付单号"
width="180">
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
</template>
</el-table-column>
<el-table-column
label="快递单号"
width="140">
<template slot-scope="scope">
<span>{{ scope.row.logisticsBillno }}</span>
</template>
</el-table-column>
<el-table-column
label="备注信息"
width="100">
<template slot-scope="scope">
<span>{{ scope.row.remark }}</span>
</template>
</el-table-column>
<el-table-column
label="退货信息"
width="100">
<template slot-scope="scope">
<span>{{ returnOrderStatus(scope.row,true) }}</span>
</template>
</el-table-column>
<el-table-column
label="会员卡号"
width="160">
<template slot-scope="scope">
<span>{{ scope.row.custNo }}</span>
</template>
</el-table-column>
<el-table-column
label="订单状态"
width="80">
<template slot-scope="scope">
<!--<el-popover trigger="hover" placement="top">-->
<!--<p>姓名: {{ scope.row.name }}</p>-->
<!--<p>住址: {{ scope.row.address }}</p>-->
<!--<div slot="reference" class="name-wrapper">-->
<!--<el-tag size="medium">{{ scope.row.couponStatus }}</el-tag>-->
<!--</div>-->
<!--</el-popover>-->
<span>{{ orderStatus(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.$index, scope.row)">详情</el-button>
<el-button v-if="showReTurnBtn(scope.row)"
size="mini"
type="danger"
@click="handleRetrun(scope.$index, scope.row)">退货</el-button>
</template>
</el-table-column>
</el-table>
<section>
<div class="block">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNo"
:page-sizes="[20]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</section>
</div>
</template>
<script>
import { orderMixin, format } from '../mixin'
export default {
mixins: [orderMixin, format],
data () {
return {
pageNo: 1,
pageSize: 20,
formInline: {
orderId: '',
customerMobile: '',
logisticsBillno: '',
custNo: '',
storeName: '',
remark: '',
orderStatus: ''
},
dateData: []
}
},
created () {
this.$store.dispatch('getOrders', {pageNo: this.pageNo, pageSize: this.pageSize})
console.log(this)
},
computed: {
tableData () {
return this.$store.getters.getOrders
},
total () {
return this.$store.getters.getOrdersTotal
}
},
methods: {
handleEdit (index, row) {
console.log(index, row)
this.$router.push({
name: 'detail',
params: { id: row.id }
})
},
handleRetrun (index, row) {
this.$router.push({
name: 'returnOrderCreate',
params: { id: row.id }
})
},
handleSizeChange (val) {
this.pageSize = val
const params = this.getParmas()
this.$store.dispatch('getOrders', params)
},
handleCurrentChange (val) {
// console.log(`当前页: ${val}`)
this.pageNo = val
const params = this.getParmas()
this.$store.dispatch('getOrders', params)
},
resetPageNo () {
this.pageNo = 1
},
getParmas () {
const len = this.dateData.length
// theStartDate 下单时间
let theStartDate = len > 0 ? this.dateData[0] : ''
// theEndDate 结束时间
let theEndDate = len > 1 ? this.dateData[1] : ''
theStartDate = this.formatDate(theStartDate, 'YYYY-MM-DD')
theEndDate = this.formatDate(theEndDate, 'YYYY-MM-DD')
const params = {
pageNo: this.pageNo,
theStartDate,
theEndDate,
pageSize: this.pageSize,
...this.formInline
}
return params
},
onSubmit () {
this.resetPageNo()
const params = this.getParmas()
this.$store.dispatch('getOrders', params)
},
resetForm () {
this.formInline = {
orderId: '',
customerMobile: '',
logisticsBillno: '',
custNo: '',
storeName: '',
remark: '',
orderStatus: ''
}
this.dateData = []
}
}
}
</script>
<style scoped>
section {
margin-top: 20px;
}
</style>
<template>
<div class="order-setting">
<el-row>
<el-col :span="12">
<el-form ref="form" label-position="left" :model="form" label-width="120px">
<el-form-item label="下单送券">
<el-switch
:active-value="1"
:inactive-value="0"
v-model="form.sendCouponFlag"></el-switch>
</el-form-item>
<el-form-item label="优惠券code">
<el-row :gutter="20">
<el-col :span="10">
<el-input v-model.trim="couponCode"
placeholder="请输入优惠券code码"
clearable
@keyup.enter="addCouponCode()"
></el-input>
</el-col>
<el-col :span="2">
<el-button icon="el-icon-circle-plus-outline" type="primary" @click="addCouponCode()">添加优惠券</el-button>
</el-col>
</el-row>
<el-row style="margin-top: 20px;" :key="index" v-for="(code,index ) in couponCodes">
<el-col :span="8">
<el-button icon="el-icon-remove-outline" type="danger" @click="deleteCoupou(index)">{{code}}</el-button>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="下单限制">
<el-switch
:active-value="1"
:inactive-value="0"
v-model="form.inventoryLimitFlag"></el-switch>
</el-form-item>
<el-form-item>
<el-row style="min-width: 420px;">
<el-col :span="5" style="min-width: 130px;">当门店库存数量少于</el-col>
<el-col :span="2" style="min-width: 80px;"><el-input size="small" v-model="form.inventoryLimitQuantity"></el-input></el-col>
<el-col :span="6" style="min-width: 180px;">&nbsp;&nbsp;件时,可进行快递到家下单</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">保存设置</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
name: 'orderSetting',
data () {
return {
form: {
id: '1',
inventoryLimitQuantity: '',
sendCouponFlag: 0,
couponCode: '',
inventoryLimitFlag: 0
},
couponCode: '',
couponCodes: []
}
},
created () {
this.$store.dispatch('getEntityById')
.then(res => {
if (`${res.data.code}` === `0`) {
this.initForm(res.data.data)
} else {
this.$alert(res.data.message)
}
})
},
methods: {
onSubmit () {
this.form.couponCode = this.couponCodes.join(',')
const params = this.form
this.$store.dispatch('saveOrUpdate', params).then(res => {
this.$alert(res.data.message)
})
// const pass = this.validate()
// if (pass) {
// this.$store.dispatch('saveOrUpdate', params).then(res => {
// this.$alert(res.data.message)
// })
// } else {
// this.$alert('请检查配置项!')
// }
},
initForm (orderConfig) {
if (orderConfig.couponCode) {
const codes = orderConfig.couponCode.split(',')
this.couponCodes = codes
}
Object.assign(this.form, orderConfig)
},
validate () {
let validates = []
for (let prop in this.form) {
const value = this.form[prop]
if (!value) {
validates.push(prop)
}
}
if (validates.indexOf('sendCouponFlag') > -1 && validates.indexOf('inventoryLimitFlag') > -1) {
return false
}
return true
},
addCouponCode () {
const code = this.couponCode
if (!code) {
this.$alert('请输入优惠券code')
return
}
if (this.couponCodes.length > 10) {
this.$alert('优惠券数量超过10个!')
return
}
this.couponCodes.push(code)
this.couponCode = ''
},
deleteCoupou (index) {
this.couponCodes = this.couponCodes.filter((item, idx) => idx !== index)
}
}
}
</script>
<style scoped>
.order-setting {
margin-top: 20px;
}
</style>
<template>
<div class="order">
<section class="form-content">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="会员手机号">
<el-input v-model="formInline.returnUser" placeholder="请输入会员手机号"></el-input>
</el-form-item>
<el-form-item label="订单编号">
<el-input v-model="formInline.orderIdStr" placeholder="请输入订单编号"></el-input>
</el-form-item>
<el-form-item label="退单编号">
<el-input v-model="formInline.returnId" placeholder="请输入订单编号"></el-input>
</el-form-item>
<el-form-item label="物流号">
<el-input v-model="formInline.logisticsNo" placeholder="请输入快递单号"></el-input>
</el-form-item>
<el-form-item label="退单申请时间">
<el-date-picker
v-model="dateData"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="下单门店">
<el-input v-model="formInline.storeName" placeholder="请输入下单门店号"></el-input>
</el-form-item>
<el-form-item label="退单状态:">
<el-select v-model="formInline.orderReturnStatus" placeholder="请选择订单状态">
<el-option v-if="key !== '0'" :key="key" :label="value" :value="key" v-for="(value,key) in returnOrderStates()"></el-option>
</el-select>
</el-form-item>
<el-form-item label="会员卡号">
<el-input v-model="formInline.custNo" placeholder="请输入会员卡号"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
<el-button @click="resetForm()">重置</el-button>
</el-form-item>
</el-form>
</section>
<el-table
:data="tableData"
style="width: 100%">
<el-table-column
label="退货单号"
width="180">
<template slot-scope="scope">
<span >{{ scope.row.id }}</span>
</template>
</el-table-column>
<el-table-column
label="订单编号"
width="180">
<template slot-scope="scope">
<span >{{ scope.row.orderId }}</span>
</template>
</el-table-column>
<el-table-column
label="下单门店"
width="180">
<template slot-scope="scope">
<span >{{ scope.row.storeName }}</span>
</template>
</el-table-column>
<el-table-column
label="物流号"
width="180">
<template slot-scope="scope">
<span >{{ scope.row.logisticsNo }}</span>
</template>
</el-table-column>
<el-table-column
label="退款金额"
width="100">
<template slot-scope="scope">
<span>{{ scope.row.realRefundAmount }}</span>
</template>
</el-table-column>
<el-table-column
label="手机号"
width="180">
<template slot-scope="scope">
<span>{{ scope.row.returnUser }}</span>
</template>
</el-table-column>
<el-table-column
label="申请时间"
width="180">
<template slot-scope="scope">
<span >{{ formatDate(scope.row.createTime,'YYYY-MM-DD hh:mm:ss')}}</span>
</template>
</el-table-column>
<el-table-column
label="会员卡号"
width="160">
<template slot-scope="scope">
<span >{{ scope.row.custNo }}</span>
</template>
</el-table-column>
<el-table-column
label="退货状态"
width="100">
<template slot-scope="scope">
<span>{{ returnOrderStatus(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column
label="优惠券状态"
width="140">
<template slot-scope="scope">
<span>{{ scope.row.returnCouponStatus }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.$index, scope.row)">详情</el-button>
</template>
</el-table-column>
</el-table>
<section>
<div class="block">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNo"
:page-sizes="[20]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</section>
</div>
</template>
<script>
import { orderMixin, format } from '../mixin'
export default {
mixins: [orderMixin, format],
data () {
return {
pageNo: 1,
pageSize: 20,
formInline: {
returnUser: '',
orderIdStr: '',
storeName: '',
returnId: '',
logisticsNo: '',
orderReturnStatus: '',
custNo: ''
},
dateData: []
}
},
created () {
this.$store.dispatch('getReturnOrders', {pageNo: this.pageNo, pageSize: this.pageSize})
},
computed: {
tableData () {
return this.$store.getters.getReturnOrders
},
total () {
return this.$store.getters.getReturnOrdersTotal
}
},
methods: {
handleEdit (index, row) {
this.$router.push({
name: 'returnOrderDetail',
params: { id: row.id }
})
},
handleRetrun (index, row) {
this.$router.push({
name: 'returnOrderCreate',
params: { id: row.id }
})
},
handleSizeChange (val) {
this.pageSize = val
const params = this.getParmas()
this.$store.dispatch('getReturnOrders', params)
},
handleCurrentChange (val) {
// console.log(`当前页: ${val}`)
this.pageNo = val
const params = this.getParmas()
this.$store.dispatch('getReturnOrders', params)
},
resetForm () {
this.formInline = {
returnUser: '',
orderIdStr: '',
returnId: '',
storeName: '',
logisticsNo: '',
orderReturnStatus: '',
custNo: ''
}
this.dateData = []
},
getParmas () {
const len = this.dateData.length
// theStartDate 下单时间
let theStartDate = len > 0 ? this.dateData[0] : ''
// theEndDate 结束时间
let theEndDate = len > 1 ? this.dateData[1] : ''
theStartDate = this.formatDate(theStartDate, 'YYYY-MM-DD')
theEndDate = this.formatDate(theEndDate, 'YYYY-MM-DD')
const params = {
pageNo: this.pageNo,
theStartDate,
theEndDate,
pageSize: this.pageSize,
...this.formInline
}
return params
},
resetPageNo () {
this.pageNo = 1
},
onSubmit () {
this.resetPageNo()
const params = this.getParmas()
this.$store.dispatch('getReturnOrders', params)
}
}
}
</script>
<style scoped>
section {
margin-top: 20px;
}
</style>
<template>
<div class="return-order">
<el-form>
<el-row class="content" >
<el-col :sm="20" :lg="22">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>发起退货</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="goBack()">返回列表</el-button>
</div>
<el-row class="row div-margin">
<h5>订单基本信息</h5>
</el-row>
<el-row class="row div-margin">
<el-col :md="8">订单编号: {{order.id }}</el-col>
<el-col :md="8">订单交易号: {{order.id }}</el-col>
</el-row>
<el-row>
<el-col :md="8">下单金额: {{order.paidFee}}</el-col>
<el-col :md="8">
订单状态:{{orderStatus(order,true)}}
</el-col>
</el-row>
<el-row class="row div-margin">
<el-col :md="8">下单时间: {{formatDate(order.createTime)}}</el-col>
<el-col :md="8">下单门店: {{order.storeName }}</el-col>
</el-row>
<el-row class="row div-margin">
<el-col :md="8">物流公司:{{order.logisticsName }}</el-col>
<el-col :md="8">快递单号:{{order.logisticsBillno }}</el-col>
</el-row>
<el-row class="row div-margin">
<el-col :md="8">运费: {{order.logisticsTotalFee ? (order.logisticsTotalFee + '元') : '无运费'}}</el-col>
</el-row>
<el-row class="row div-margin">
<el-col :md="8">
退货原因:
<el-select v-model="ruleForm.reason" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</el-col>
</el-row>
<hr>
<el-row >
<h5>退货商品信息</h5>
</el-row>
<el-table
ref="multipleTable"
:data="order.orderProducts"
select-on-indeterminate
@selection-change="handleSelectionChange"
style="width: 100%">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
label="商品ID"
>
<template slot-scope="scope">
<span >{{ scope.row.girard }}</span>
</template>
</el-table-column>
<el-table-column
label="商品名称"
>
<template slot-scope="scope">
<span >{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column
label="SKU"
>
<template slot-scope="scope">
<span >{{ scope.row.barCode }}</span>
</template>
</el-table-column>
<el-table-column
label="颜色"
>
<template slot-scope="scope">
<span >{{ scope.row.colorName }}</span>
</template>
</el-table-column>
<el-table-column
label="尺码"
>
<template slot-scope="scope">
<span>{{ scope.row.sizeName }}</span>
</template>
</el-table-column>
<el-table-column
label="商品活动价"
>
<template slot-scope="scope">
<span >{{ scope.row.activityPrice }}</span>
</template>
</el-table-column>
<el-table-column
label="商品数量"
>
<template slot-scope="scope">
<span >{{ scope.row.count }}</span>
</template>
</el-table-column>
</el-table>
<hr>
<el-form-item label="退款金额" prop="pass">
<el-input-number :precision="2" :step="0.1" v-model="ruleForm.price" ></el-input-number>
<el-checkbox v-model="ruleForm.hasLogistics">退运费</el-checkbox>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm()">提交</el-button>
<!--<el-button @click="resetForm()">取消</el-button>-->
</el-form-item>
</el-card>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import { orderMixin, format, calcPrice } from '../mixin'
export default {
name: 'returnOrder',
mixins: [orderMixin, format, calcPrice],
data () {
return {
ruleForm: {
price: 0,
reason: '',
hasLogistics: false
},
options: [{ // 所有退货原因
value: 0,
name: '请选择'
}, {
value: 1,
name: '质量问题'
}, {
value: 2,
name: '大小尺码问题'
}, {
value: 3,
name: '不想要了'
}, {
value: 4,
name: '卖家发错漏发'
}, {
value: 5,
name: '拍错商品'
}, {
value: 6,
name: '商品实物与描述不同'
}],
multipleSelection: []
}
},
created () {
const orderId = this.$route.params.id
this.$store.dispatch('getOrder', orderId)
},
computed: {
order () {
const order = this.$store.getters.getOrder
this.$nextTick(() => {
this.initSelection(order.orderProducts)
this.setHasLogistics(this.orderStatus(order, true) === '待发货')
})
return order
}
},
watch: {
'ruleForm.hasLogistics': function (newV) {
this.changeLogistics(newV)
}
},
methods: {
goBack () {
this.$router.back()
},
setHasLogistics (hasLogistics) {
this.ruleForm.hasLogistics = hasLogistics
},
changeLogistics (logistics) {
const goodsPrice = this.calcPrice(this.order.orderProducts)
if (logistics) {
const price = goodsPrice + this.order.logisticsTotalFee
this.setPrice(price)
} else {
this.setPrice(goodsPrice)
}
},
resetForm () {
this.ruleForm = {
price: 0,
reason: ''
}
this.multipleSelection = []
},
submitForm () {
const orderReturnProductList = this.multipleSelection.map((item) => {
return {
barCode: item.barCode,
colorCode: item.colorCode,
colorName: item.colorName,
girard: item.girard,
name: item.name,
orderId: item.orderId,
orderProductId: item.id,
price: item.price,
quantity: item.count,
sizeId: item.sizeId,
sizeName: item.sizeName
}
})
const params = {
orderId: this.$route.params.id,
custNo: this.order.custNo,
storeId: this.order.storeId,
storeName: this.order.storeName,
orderReturnProductList,
remark: '',
returnUser: this.order.customerMobile,
reason: this.ruleForm.reason,
realRefundAmount: this.ruleForm.price,
orderReturnImage: [],
promotionName: this.order.promotionName,
promotionPrice: this.order.promotionPrice,
couponName: this.order.couponName,
couponPrice: this.order.couponPrice
}
const pass = this.validate(params, 'realRefundAmount', '大于0')
if (pass) {
this.$store.dispatch('saveOrderReturn', params).then((res) => {
this.$alert('发起退货成功!').then(() => {
this.goBack()
})
})
} else {
this.$message('退款金额要大于0!')
}
},
validate (parmas, props, rule) {
if (rule === '大于0') {
return parmas[props] && parmas[props] > 0
}
},
calcPrice (activitys) {
return this.calcActivityPrice(activitys)
},
setPrice (price) {
this.ruleForm.price = price
},
handleSelectionChange (val) {
this.multipleSelection = val
this.changeLogistics(this.ruleForm.hasLogistics)
}
}
}
</script>
<style scoped>
.text {
font-size: 14px;
}
.item {
margin-bottom: 18px;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.box-card {
margin-top: 20px;
}
.el-row {
min-height: 40px;
line-height: 40px;
}
h5 {
color:#303133;
font-weight: bold;
}
.order-title {
font-weight: bold;
}
.el-row + .el-row {
margin-top: 20px;
}
</style>
let env = process.env
let api = `${env.host}`
console.log(env)
export default {
base: `${api}/${env.project}/${env.requestUrl}/`,
...env
}
import axios from 'axios'
// import qs from 'qs'
import store from '@/store'
import config from '../config'
// Add a request interceptor
axios.interceptors.request.use(function (config) {
// Do something before request is sent
// console.log('======= config =======%o', config)
return config
}, function (error) {
// Do something with request error
return Promise.reject(error)
})
// Add a response interceptor
axios.interceptors.response.use(function (response) {
// Do something with response data
if (response.data.code === -1) {
return Promise.reject(response.data.message)
}
if (response.status >= 500) {
console.log(`========== response ======== %o`, response)
}
return response
}, function (error) {
// Do something with response error
return Promise.reject(error)
})
const api = axios.create({
baseURL: config.base
})
api.interceptors.request.use(function (config) {
store.dispatch('show_loading')
// Do something before request is sent
if (config.method === 'post') {
// config.data = qs.stringify(config.data)
}
return config
}, function (error) {
// Do something with request error
return Promise.reject(error)
})
// Add a response interceptor
api.interceptors.response.use(function (response) {
store.dispatch('hide_loading')
// Do something with response data
if (response.status >= 500) {
throw new Error('500!!!')
}
return response
}, function (error) {
// Do something with response error
return Promise.reject(error)
})
// api.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
class BaseHttpServer {
constructor (url) {
if (url) {
this.baseUrl = url
}
this.api = api
}
get (url, params) {
return this.api.get(`${this.baseUrl}/${url}`, { params })
.catch((error) => {
console.log(error)
})
}
post (url, params) {
return this.api.post(`${this.baseUrl}/${url}`, params)
.catch((error) => {
console.log(error)
})
}
}
export {
axios,
api,
BaseHttpServer as Http
}
// {
// // `url` is the server URL that will be used for the request
// url: '/user',
//
// // `method` is the request method to be used when making the request
// method: 'get', // default
//
// // `baseURL` will be prepended to `url` unless `url` is absolute.
// // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
// // to methods of that instance.
// baseURL: 'https://some-domain.com/api/',
//
// // `transformRequest` allows changes to the request data before it is sent to the server
// // This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
// // The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
// // FormData or Stream
// // You may modify the headers object.
// transformRequest: [function (data, headers) {
// // Do whatever you want to transform the data
//
// return data;
// }],
//
// // `transformResponse` allows changes to the response data to be made before
// // it is passed to then/catch
// transformResponse: [function (data) {
// // Do whatever you want to transform the data
//
// return data;
// }],
//
// // `headers` are custom headers to be sent
// headers: {'X-Requested-With': 'XMLHttpRequest'},
//
// // `params` are the URL parameters to be sent with the request
// // Must be a plain object or a URLSearchParams object
// params: {
// ID: 12345
// },
//
// // `paramsSerializer` is an optional function in charge of serializing `params`
// // (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
// paramsSerializer: function(params) {
// return Qs.stringify(params, {arrayFormat: 'brackets'})
// },
//
// // `data` is the data to be sent as the request body
// // Only applicable for request methods 'PUT', 'POST', and 'PATCH'
// // When no `transformRequest` is set, must be of one of the following types:
// // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
// // - Browser only: FormData, File, Blob
// // - Node only: Stream, Buffer
// data: {
// firstName: 'Fred'
// },
//
// // `timeout` specifies the number of milliseconds before the request times out.
// // If the request takes longer than `timeout`, the request will be aborted.
// timeout: 1000,
//
// // `withCredentials` indicates whether or not cross-site Access-Control requests
// // should be made using credentials
// withCredentials: false, // default
//
// // `adapter` allows custom handling of requests which makes testing easier.
// // Return a promise and supply a valid response (see lib/adapters/README.md).
// adapter: function (config) {
// /* ... */
// },
//
// // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
// // This will set an `Authorization` header, overwriting any existing
// // `Authorization` custom headers you have set using `headers`.
// auth: {
// username: 'janedoe',
// password: 's00pers3cret'
// },
//
// // `responseType` indicates the type of data that the server will respond with
// // options are 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream'
// responseType: 'json', // default
//
// // `responseEncoding` indicates encoding to use for decoding responses
// // Note: Ignored for `responseType` of 'stream' or client-side requests
// responseEncoding: 'utf8', // default
//
// // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
// xsrfCookieName: 'XSRF-TOKEN', // default
//
// // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
// xsrfHeaderName: 'X-XSRF-TOKEN', // default
//
// // `onUploadProgress` allows handling of progress events for uploads
// onUploadProgress: function (progressEvent) {
// // Do whatever you want with the native progress event
// },
//
// // `onDownloadProgress` allows handling of progress events for downloads
// onDownloadProgress: function (progressEvent) {
// // Do whatever you want with the native progress event
// },
//
// // `maxContentLength` defines the max size of the http response content in bytes allowed
// maxContentLength: 2000,
//
// // `validateStatus` defines whether to resolve or reject the promise for a given
// // HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
// // or `undefined`), the promise will be resolved; otherwise, the promise will be
// // rejected.
// validateStatus: function (status) {
// return status >= 200 && status < 300; // default
// },
//
// // `maxRedirects` defines the maximum number of redirects to follow in node.js.
// // If set to 0, no redirects will be followed.
// maxRedirects: 5, // default
//
// // `socketPath` defines a UNIX Socket to be used in node.js.
// // e.g. '/var/run/docker.sock' to send requests to the docker daemon.
// // Only either `socketPath` or `proxy` can be specified.
// // If both are specified, `socketPath` is used.
// socketPath: null, // default
//
// // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
// // and https requests, respectively, in node.js. This allows options to be added like
// // `keepAlive` that are not enabled by default.
// httpAgent: new http.Agent({ keepAlive: true }),
// httpsAgent: new https.Agent({ keepAlive: true }),
//
// // 'proxy' defines the hostname and port of the proxy server
// // Use `false` to disable proxies, ignoring environment variables.
// // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
// // supplies credentials.
// // This will set an `Proxy-Authorization` header, overwriting any existing
// // `Proxy-Authorization` custom headers you have set using `headers`.
// proxy: {
// host: '127.0.0.1',
// port: 9000,
// auth: {
// username: 'mikeymike',
// password: 'rapunz3l'
// }
// },
//
// // `cancelToken` specifies a cancel token that can be used to cancel the request
// // (see Cancellation section below for details)
// cancelToken: new CancelToken(function (cancel) {
// })
// }
import userApi from './user'
import orderApi from './order'
import returnOrderApi from './returnOrder'
import OrderConfigApi from './orderConfig'
export const user = userApi
export const order = orderApi
export const returnOrder = returnOrderApi
export const orderConfig = OrderConfigApi
import { Http } from '../baseHttp'
const baseUrl = '/back/iorder'
class Order extends Http {
constructor () {
super(baseUrl)
}
getOrders (params) {
const __OPTIONS__ = {
pageNo: 1,
pageSize: 50,
orderId: '',
customerMobile: '',
logisticsBillno: '',
custNo: '',
storeName: '',
remark: '',
orderStatus: ''
}
params = Object.assign({}, __OPTIONS__, params)
return this.get(`orderlist`, params)
}
getOrderById (id) {
return this.get(`orderDetail`, { orderId: id })
}
getExpress (params) {
const __OPTIONS__ = {
logisticsCode: '',
logisticsNo: ''
}
params = Object.assign({}, __OPTIONS__, params)
return this.get(`getExpress`, params)
}
updateOrderRemark (params) {
const __OPTIONS__ = {
orderId: '',
remark: ''
}
params = Object.assign({}, __OPTIONS__, params)
return this.get(`updateOrderRemark`, params)
}
updateOrderLogisticsInfo (params) {
const __OPTIONS__ = {
orderId: '',
logisticsCode: '',
logisticsName: '',
logisticsNo: ''
}
params = Object.assign({}, __OPTIONS__, params)
return this.get(`updateOrderLogisticsInfo`, params)
}
}
export default new Order()
import { Http } from '../baseHttp'
const baseUrl = '/back/iorderConfig'
class OrderConfig extends Http {
constructor () {
super(baseUrl)
}
saveOrUpdate (params) {
const __OPTIONS__ = {
id: '',
inventoryLimitQuantity: '',
sendCouponFlag: '',
couponCode: '',
inventoryLimitFlag: ''
}
params = Object.assign({}, __OPTIONS__, params)
return this.post(`saveOrUpdate`, params)
}
getEntityById (params = {}) {
const __OPTIONS__ = {
orderConfigId: 1
}
params = Object.assign({}, __OPTIONS__, params)
return this.get(`getEntityById`, params)
}
}
export default new OrderConfig()
import { Http } from '../baseHttp'
const baseUrl = '/back/ireturn'
class ReturnOrder extends Http {
constructor () {
super(baseUrl)
}
saveOrderReturn (params) {
const __OPTIONS__ = {
orderId: 1,
custNo: '',
storeId: '',
storeName: '',
returnUser: '',
orderReturnProductList: '',
remark: '',
reason: '',
isCustomer: 2, // 写死区分是后台发起的退货
orderReturnImage: [],
promotionName: '',
promotionPrice: '',
couponName: '',
couponPrice: ''
}
params = Object.assign({}, __OPTIONS__, params)
return this.post('saveOrderReturn', params)
}
getReturnOrders (params) {
const __OPTIONS__ = {
// pageNo: 1,
// pageSize: 50,
// orderId: '',
// customerMobile: '',
// logisticsId: '',
// custNo: '',
// orderStatus: ''
}
params = Object.assign({}, __OPTIONS__, params)
return this.get(`returnlist`, params)
}
getReturnOrderById (id) {
return this.get(`returnDetail`, { returnId: id })
}
updateStatus (params) {
const __OPTIONS__ = {
orderId: '',
returnId: '',
oldStatus: '',
status: '',
realRefundAmount: ''
}
params = Object.assign({}, __OPTIONS__, params)
return this.get(`updateStatus`, params)
}
payReturn (params) {
const __OPTIONS__ = {
orderId: '',
returnId: '',
status: '',
realRefundAmount: ''
}
params = Object.assign({}, __OPTIONS__, params)
return this.get(`payReturn`, params)
}
}
export default new ReturnOrder()
import { api as http } from '../baseHttp'
export default {
login: ({username, password}) => {
const params = { username, password }
return http.get('/user/login', {params})
}
}
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import 'es6-promise/auto'
import store from './store'
// import VueRx from 'vue-rx'
import { sync } from 'vuex-router-sync'
import { momentPlugin, utils } from '@/plugin'
// Vue.use(VueRx)
Vue.config.productionTip = false
// 注册router 到 store
sync(store, router)
// const unsync = sync(store, router)
// unsync()
Vue.use(momentPlugin)
Vue.use(utils)
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
components: { App },
template: '<App/>'
})
import momentPlugin from './moment'
import validate from './validate'
import utils from './underscore'
export {
momentPlugin,
utils,
validate
}
import moment from 'moment'
class Moment {
install (Vue, options) {
// 4. 添加实例方法
Vue.prototype.$moment = moment
}
}
export default new Moment()
// https://www.npmjs.com/package/validate
import _ from 'underscore'
class Utils {
install (Vue, options) {
// 4. 添加实例方法
Vue.prototype.$_ = _
}
}
export default new Utils()
// https://www.npmjs.com/package/validate
import Schema from 'validate'
class Validate {
install (Vue, options) {
// 4. 添加实例方法
Vue.prototype.$validator = Schema
}
}
export default new Validate()
/* eslint-disable no-return-assign */
import Vue from 'vue'
import Router from 'vue-router'
import config from '../config'
Vue.use(Router)
function getConfigRouters () {
// 分页面加载路由 避免router.js过大
let cache = {}
let routers = []// 所有的路由配置数组
function importAll (r) {
r.keys().forEach((key) => {
routers.push(r(key).default)
return cache[key] = r(key)
})
}
importAll(require.context('../views/', true, /\.router\.js$/))
return routers
}
// 配置路由
let routers = getConfigRouters()
const router = new Router({
base: `/${config.baseUrl}/${config.url}/`,
mode: 'history',
routes: [
...routers,
{
path: '**',
redirect: ''
}
]
})
router.beforeEach((to, from, next) => {
next()
})
export default router
import * as types from './mutations_types'
export default {
show_loading: ({
commit
}) => {
return new Promise((resolve, reject) => {
commit(types.SHOW_LOADING)
resolve()
})
},
hide_loading: ({
commit
}) => {
return new Promise((resolve, reject) => {
commit(types.HIDE_LOADING)
resolve()
})
}
}
export default {
getLoadStatus (state) {
return state.ajax_loading
}
}
import state from './state'
import mutations from './mutations'
import getters from './getters'
import actions from './actions'
export default {
state,
mutations,
getters,
actions
}
import * as types from './mutations_types'
// import { store } from 'utils/'
export default {
[types.SHOW_LOADING] (state) {
state.ajax_loading = true
},
[types.HIDE_LOADING] (state) {
state.ajax_loading = false
}
}
// 显示加载
export const SHOW_LOADING = 'SHOW_LOADING'
// 关闭加载
export const HIDE_LOADING = 'HIDE_LOADING'
export default {
ajax_loading: false
}
import Vue from 'vue'
import Vuex from 'vuex'
import createLogger from 'vuex/dist/logger'
import global from './global'
// import user from './user'
// import order from './order'
// import returnOrder from './returnOrder'
// import orderConfig from './orderConfig'
Vue.use(Vuex)
const debug = process.env.NODE_ENV !== 'production'
const store = new Vuex.Store({
modules: {
global
// user,
// order,
// returnOrder,
// orderConfig
},
strict: debug,
plugins: debug ? [createLogger()] : []
})
if (module.hot) {
module.hot.accept([
// './getters',
// './actions',
// './mutations'
], () => {
store.hotUpdate({
// getters: require('./getters'),
// actions: require('./actions'),
// mutations: require('./mutations')
})
})
}
export default store
import { order } from '@/http'
// 获取订单
const GET_ORDERS = 'GET_ORDERS'
// 获取单个订单
const GET_ORDER = 'GET_ORDER'
// 订单总数
const TOTAL_ORDERS = 'TOTAL_ORDERS'
// 物流信息
const GET_EXPRESS = 'GET_EXPRESS'
const state = {
orders: [],
order: {},
express: [],
total: 0
}
const actions = {
getOrders ({
commit, dispatch
}, parmas) {
return order.getOrders(parmas).then((res) => {
const orders = res.data.page.result
const total = res.data.page.totalCount
commit(GET_ORDERS, orders)
dispatch('getOrdersTotal', total)
})
},
getOrdersTotal ({commit}, total) {
commit(TOTAL_ORDERS, total)
},
getOrder ({commit, dispatch}, id) {
return order.getOrderById(id).then(res => {
const order = res.data.order
// orderStatus === '3' && returnStatus !== '6'
if (`${order.orderStatus}` === '3' && `${order.returnStatus}` !== '6') {
dispatch('getExpress', {
logisticsCode: order.logisticsCode,
logisticsNo: order.logisticsNo
})
}
commit(GET_ORDER, order)
})
},
getExpress ({
commit, dispatch
}, parmas) {
return order.getExpress(parmas).then((res) => {
let express = []
const data = JSON.parse(res.data)
if (`${data.code}` === '500') {
express.push({
context: data.message
// ftime: new Date().getTime()
})
} else {
express = data.data
}
commit(GET_EXPRESS, express)
})
},
updateOrderRemark ({
commit, dispatch
}, parmas) {
return order.updateOrderRemark(parmas)
},
updateOrderLogisticsInfo ({
commit, dispatch
}, parmas) {
return order.updateOrderLogisticsInfo(parmas)
}
}
const getters = {
getOrders (state) {
return state.orders
},
getOrdersTotal (state) {
return state.total
},
getOrder (state) {
return state.order
},
getExpress (state) {
return state.express
}
}
const mutations = {
[GET_ORDERS] (state, orders) {
state.orders = orders
},
[TOTAL_ORDERS] (state, total) {
state.total = total
},
[GET_ORDER] (state, order) {
state.order = order
},
[GET_EXPRESS] (state, express) {
state.express = express
}
}
export default {
state,
mutations,
actions,
getters
}
import { orderConfig } from '@/http'
// 保存下单配置
// const SAVE_OR_UPDATE = 'saveOrUpdate'
// 获取下单配置
const GET_ENTITY_BY_ID = 'getEntityById'
const state = {
detail: {
id: '',
inventoryLimitQuantity: '',
sendCouponFlag: '',
couponCode: '',
inventoryLimitFlag: ''
}
}
const actions = {
saveOrUpdate ({
commit, dispatch
}, parmas) {
return orderConfig.saveOrUpdate(parmas)
},
getEntityById ({commit, dispatch}, id = 1) {
return orderConfig.getEntityById(id).then(res => {
const orderConfig = res.data.data
commit(GET_ENTITY_BY_ID, orderConfig)
return Promise.resolve(res)
})
}
}
const getters = {
orderConfig (state) {
return state.detail
}
}
const mutations = {
[GET_ENTITY_BY_ID] (state, orderConfig) {
state.detail = { ...orderConfig }
}
}
export default {
state,
mutations,
actions,
getters
}
import { returnOrder } from '@/http'
// 获取退货订单
const GET_RETURN_ORDERS = 'GET_TETURN_ORDERS'
// 获取单个退货订单
const GET_RETURN_ORDER = 'GET_RETURN_ORDER'
// 订单总数
const TOTAL_TETURN_ORDER = 'TOTAL_TETURN_ORDER'
const state = {
returnOrders: [],
detail: {},
returnTotal: 0
}
const actions = {
getReturnOrders ({
commit, dispatch
}, parmas) {
return returnOrder.getReturnOrders(parmas).then((res) => {
const orders = res.data.page.result
const total = res.data.page.totalCount
commit(GET_RETURN_ORDERS, orders)
dispatch('getReturnOrdersTotal', total)
})
},
getReturnOrdersTotal ({commit}, total) {
commit(TOTAL_TETURN_ORDER, total)
},
getReturnOrder ({commit}, id) {
return returnOrder.getReturnOrderById(id).then(res => {
const orderReturn = res.data.orderReturn
const order = res.data.order
commit('GET_ORDER', order)
commit(GET_RETURN_ORDER, orderReturn)
})
},
saveOrderReturn ({commit}, parmas) {
return returnOrder.saveOrderReturn(parmas)
},
updateStatus ({commit}, parmas) {
// const state = {
// 2: '审核通过',
// 3: '驳回退货',
// 7: '确认退货',
// 4: '取消退货',
// 5: '确认收货'
// }
// const status = parmas.status
return returnOrder.updateStatus(parmas).then(res => {
console.log(res)
if (`${res.data.code}` === '0') {
return Promise.resolve({
data: {
message: `操作成功`
}})
} else {
return Promise.resolve({
data: {
message: `操作失败`
}})
}
})
},
payReturn ({commit}, parmas) {
return returnOrder.payReturn(parmas).then(res => {
if (`${res.data.code}` === '0') {
return Promise.resolve({
data: {
message: `退款成功`
}})
} else {
return Promise.resolve({
data: {
message: `退款失败`
}})
}
})
}
}
const getters = {
getReturnOrders (state) {
return state.returnOrders
},
getReturnOrdersTotal (state) {
return state.returnTotal
},
getReturnOrder (state) {
return state.detail
}
}
const mutations = {
[GET_RETURN_ORDERS] (state, orders) {
state.returnOrders = [...orders]
},
[TOTAL_TETURN_ORDER] (state, total) {
state.returnTotal = total
},
[GET_RETURN_ORDER] (state, orderReturn) {
state.detail = orderReturn
}
}
export default {
state,
mutations,
actions,
getters
}
import * as types from './mutations_types.js'
import { user } from '@/http'
export default {
login ({
commit,
dispatch
}, userInfo) {
return user.login(userInfo)
.then((res) => {
if (res.data.code === 0) {
dispatch('updateUserInfo', userInfo)
return Promise.resolve(res)
} else {
return Promise.resolve({
data: {
message: '登陆失败'
}})
}
})
},
updateUserInfo ({commit}, userInfo) {
commit(types.UPDATE_USERINFO, userInfo)
}
}
export default {
getUserinfo (state) {
return state.userinfo
},
getToken (state) {
return state.userinfo && state.userinfo.token ? state.userinfo.token : ''
},
getRemumber (state) {
return state.remumber
}
}
import state from './state.js'
import mutations from './mutations.js'
import actions from './actions.js'
import getters from './getters.js'
export default {
state,
mutations,
actions,
getters
}
import * as types from './mutations_types'
export default {
[types.UPDATE_USERINFO] (state, userDb) {
state.userinfo = userDb.userinfo || {}
}
}
// 用户登陆
export const USER_LOGIN = 'USER_LOGIN'
// 更新用户信息
export const UPDATE_USERINFO = 'UPDATE_USERINFO'
export default {
// 登录成功后的用户信息
userinfo: {
username: ''
},
// 记住密码相关信息,现在暂且只做记住一个账号密码
// 后期:每次登录成功一次,就缓存到列表中,然后在登录表单,输入时,会出现下拉列表选择之前登录过得用户
remumber: {
remumberFlag: true,
remumberLoginInfo: {
username: '',
token: ''
}
}
}
import date from './moment'
export const M = date
import moment from 'moment'
export default moment
<template>
<div class="container-fluid">
<div class="page-header"><h1>页面不存在.</h1></div>
<div><a href="javascript:" onclick="history.go(-1);" class="btn">返回上一页</a></div>
</div>
</template>
<script>
export default {
name: 'code404'
}
</script>
<style scoped>
</style>
<template>
<div class="container-fluid">
<div class="page-header"><h1>系统发生内部错误.</h1></div>
<div><a href="javascript:" onclick="history.go(-1);" class="btn">返回上一页</a></div>
</div>
</template>
<script>
export default {
name: 'code500'
}
</script>
<style scoped>
</style>
export default {
path: '/error',
name: '',
auth: false,
component: resolve => require(['./error.vue'], resolve),
children: [{
path: '500',
name: 'page-500',
meta: {
title: '500 - 系统内部错误',
auth: true
},
component: resolve => require(['./code500.vue'], resolve)
}, {
path: '400',
name: 'page-404',
meta: {
title: '404 - 页面不存在',
auth: true
},
component: resolve => require(['./code500.vue'], resolve)
}]
}
<template>
<div class="error">
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'error'
}
</script>
<style scoped>
</style>
// A custom Nightwatch assertion.
// The assertion name is the filename.
// Example usage:
//
// browser.assert.elementCount(selector, count)
//
// For more information on custom assertions see:
// http://nightwatchjs.org/guide#writing-custom-assertions
exports.assertion = function (selector, count) {
this.message = 'Testing if element <' + selector + '> has count: ' + count
this.expected = count
this.pass = function (val) {
return val === this.expected
}
this.value = function (res) {
return res.value
}
this.command = function (cb) {
var self = this
return this.api.execute(function (selector) {
return document.querySelectorAll(selector).length
}, [selector], function (res) {
cb.call(self, res)
})
}
}
require('babel-register')
var config = require('../../config')
// http://nightwatchjs.org/gettingstarted#settings-file
module.exports = {
src_folders: ['test/e2e/specs'],
output_folder: 'test/e2e/reports',
custom_assertions_path: ['test/e2e/custom-assertions'],
selenium: {
start_process: true,
server_path: require('selenium-server').path,
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path
}
},
test_settings: {
default: {
selenium_port: 4444,
selenium_host: 'localhost',
silent: true,
globals: {
devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
}
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}
}
// 1. start the dev server using production config
process.env.NODE_ENV = 'testing'
const webpack = require('webpack')
const DevServer = require('webpack-dev-server')
const webpackConfig = require('../../build/webpack.prod.conf')
const devConfigPromise = require('../../build/webpack.dev.conf')
let server
devConfigPromise.then(devConfig => {
const devServerOptions = devConfig.devServer
const compiler = webpack(webpackConfig)
server = new DevServer(compiler, devServerOptions)
const port = devServerOptions.port
const host = devServerOptions.host
return server.listen(port, host)
})
.then(() => {
// 2. run the nightwatch test suite against it
// to run in additional browsers:
// 1. add an entry in test/e2e/nightwatch.conf.js under "test_settings"
// 2. add it to the --env flag below
// or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
// For more information on Nightwatch's config file, see
// http://nightwatchjs.org/guide#settings-file
let opts = process.argv.slice(2)
if (opts.indexOf('--config') === -1) {
opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
}
if (opts.indexOf('--env') === -1) {
opts = opts.concat(['--env', 'chrome'])
}
const spawn = require('cross-spawn')
const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
runner.on('exit', function (code) {
server.close()
process.exit(code)
})
runner.on('error', function (err) {
server.close()
throw err
})
})
// For authoring Nightwatch tests, see
// http://nightwatchjs.org/guide#usage
module.exports = {
'default e2e tests': function (browser) {
// automatically uses dev Server port from /config.baseHttp.js
// default: http://localhost:8080
// see nightwatch.conf.js
const devServer = browser.globals.devServerURL
browser
.url(devServer)
.waitForElementVisible('#app', 5000)
.assert.elementPresent('.hello')
.assert.containsText('h1', 'Welcome to Your Vue.js App')
.assert.elementCount('img', 1)
.end()
}
}
{
"env": {
"jest": true
},
"globals": {
}
}
const path = require('path')
module.exports = {
rootDir: path.resolve(__dirname, '../../'),
moduleFileExtensions: [
'js',
'json',
'vue'
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
transform: {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
},
testPathIgnorePatterns: [
'<rootDir>/test/e2e'
],
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
setupFiles: ['<rootDir>/test/unit/setup'],
mapCoverage: true,
coverageDirectory: '<rootDir>/test/unit/coverage',
collectCoverageFrom: [
'src/**/*.{js,vue}',
'!src/main.js',
'!src/router/baseHttp.js',
'!**/node_modules/**'
]
}
import Vue from 'vue'
Vue.config.productionTip = false
import Vue from 'vue'
import HelloWorld from '@/components/HelloWorld'
describe('HelloWorld.vue', () => {
it('should render correct contents', () => {
const Constructor = Vue.extend(HelloWorld)
const vm = new Constructor().$mount()
expect(vm.$el.querySelector('.hello h1').textContent)
.toEqual('Welcome to Your Vue.js App')
})
})
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment