Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
梁建民
/
h5
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
df3b4f8b
authored
Sep 04, 2020
by
liangjianmin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
js
parent
29299268
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
81 deletions
src/store/modules/sample/sampleapply.js
src/views/sample/sampleapply.vue
view/16.js
view/app.js
src/store/modules/sample/sampleapply.js
View file @
df3b4f8b
...
...
@@ -8,93 +8,105 @@ var qs = require('qs');
Vue
.
use
(
Toast
);
const
state
=
{
loading
:
false
,
addressInfo
:
""
,
submitState
:
false
,
ypGoodDetail
:
{},
ypComInfo
:
{},
ypBasInfo
:
{},
ordernum
:
''
loading
:
false
,
addressInfo
:
""
,
submitState
:
false
,
ypGoodDetail
:
{},
ypComInfo
:
{},
ypBasInfo
:
{},
ordernum
:
''
}
const
mutations
=
{
recvlistSample
(
state
,
payload
)
{
if
(
!
payload
.
data
){
state
.
addressInfo
=
null
}
else
{
state
.
addressInfo
=
payload
.
data
.
filter
(
function
(
item
){
return
item
[
'is_default'
]
==
1
;});
state
.
addressInfo
=
state
.
addressInfo
[
0
];
}
},
recvlistSample
(
state
,
payload
)
{
if
(
!
payload
.
data
)
{
state
.
addressInfo
=
null
}
else
{
state
.
addressInfo
=
payload
.
data
.
filter
(
function
(
item
)
{
return
item
[
'is_default'
]
==
1
;
});
state
.
addressInfo
=
state
.
addressInfo
[
0
];
}
},
}
const
actions
=
{
recvlistSample
({
commit
},
payload
)
{
Services
.
recvlist
().
then
((
res
)
=>
{
let
data
=
res
.
data
;
// state.loading = false;
console
.
log
(
data
.
err_code
)
if
(
data
.
err_code
==
0
)
{
commit
({
type
:
'recvlistSample'
,
data
:
data
.
data
});
}
else
{
commit
({
type
:
'recvlistSample'
,
data
:
null
});
}
}).
catch
(
function
(
err
)
{
recvlistSample
({
commit
},
payload
)
{
Services
.
recvlist
().
then
((
res
)
=>
{
let
data
=
res
.
data
;
// state.loading = false;
console
.
log
(
data
.
err_code
)
if
(
data
.
err_code
==
0
)
{
commit
({
type
:
'recvlistSample'
,
data
:
data
.
data
});
},
selfSampleCreate
({
commit
},
payload
)
{
state
.
loading
=
true
;
var
params
=
payload
.
data
;
Services
.
selfSampleCreate
(
qs
.
stringify
(
params
)).
then
((
res
)
=>
{
let
data
=
res
.
data
;
state
.
loading
=
false
;
if
(
data
.
err_code
==
0
)
{
state
.
submitState
=
true
;
state
.
ordernum
=
data
.
data
||
''
}
else
if
(
data
.
err_code
==
'40014'
){
Toast
(
'样品库存不足'
);
}
else
{
Toast
(
data
.
err_msg
);
}
}).
catch
(
function
(
err
)
{
state
.
loading
=
false
;
});
},
getDetailYp
({
commit
},
payload
)
{
state
.
loading
=
true
;
let
Params_
=
{
id
:
payload
.
data
.
id
,
}
let
params
=
Util
.
getParams
(
Params_
);
Services
.
getSampleInfo
(
params
).
then
((
res
)
=>
{
let
data
=
res
.
data
;
state
.
loading
=
false
;
if
(
data
.
err_code
==
0
)
{
state
.
ypGoodDetail
=
data
.
data
.
goods_info
||
{}
state
.
ypComInfo
=
data
.
data
.
company_info
||
{}
state
.
ypBasInfo
=
data
.
data
.
user_info
||
{}
}
}).
catch
(
function
(
err
)
{
state
.
loading
=
false
;
}
else
{
commit
({
type
:
'recvlistSample'
,
data
:
null
});
},
}
}).
catch
(
function
(
err
)
{
});
},
selfSampleCreate
({
commit
},
payload
)
{
state
.
loading
=
true
;
var
params
=
payload
.
data
;
Services
.
selfSampleCreate
(
qs
.
stringify
(
params
)).
then
((
res
)
=>
{
let
data
=
res
.
data
;
state
.
loading
=
false
;
if
(
data
.
err_code
==
0
)
{
state
.
submitState
=
true
;
state
.
ordernum
=
data
.
data
||
''
}
else
if
(
data
.
err_code
==
'40014'
)
{
Toast
(
'样品库存不足'
);
}
else
{
Toast
(
data
.
err_msg
);
}
}).
catch
(
function
(
err
)
{
state
.
loading
=
false
;
});
},
getDetailYp
({
commit
},
payload
)
{
state
.
loading
=
true
;
if
(
payload
.
data
.
type
)
{
let
Params_
=
{
id
:
payload
.
data
.
id
,
type
:
2
}
}
else
{
let
Params_
=
{
id
:
payload
.
data
.
id
,
}
}
let
params
=
Util
.
getParams
(
Params_
);
Services
.
getSampleInfo
(
params
).
then
((
res
)
=>
{
let
data
=
res
.
data
;
state
.
loading
=
false
;
if
(
data
.
err_code
==
0
)
{
state
.
ypGoodDetail
=
data
.
data
.
goods_info
||
{}
state
.
ypComInfo
=
data
.
data
.
company_info
||
{}
state
.
ypBasInfo
=
data
.
data
.
user_info
||
{}
}
}).
catch
(
function
(
err
)
{
state
.
loading
=
false
;
});
},
}
const
getters
=
{}
export
default
{
state
,
mutations
,
actions
,
getters
state
,
mutations
,
actions
,
getters
}
src/views/sample/sampleapply.vue
View file @
df3b4f8b
...
...
@@ -230,16 +230,30 @@
this
.
isShowComInfo
=
true
;
}
}
this
.
$store
.
dispatch
({
type
:
"getDetailYp"
,
data
:
{
type
:
'spacial'
,
id
:
this
.
goods_id
}
});
}
else
{
this
.
$store
.
dispatch
({
type
:
"getDetailYp"
,
data
:
{
id
:
this
.
goods_id
}
});
}
this
.
$store
.
dispatch
({
type
:
"getDetailYp"
,
data
:
{
id
:
this
.
goods_id
},
});
this
.
$store
.
dispatch
({
type
:
"recvlistSample"
,
});
//这里把项目需求的描述放到缓存里面,切换页面的时候缓存起来
let
sampledesccookie
=
localStorage
.
getItem
(
"sampledesc"
)
||
""
;
if
(
sampledesccookie
)
{
...
...
view/16.js
View file @
df3b4f8b
This diff is collapsed.
Click to expand it.
view/app.js
View file @
df3b4f8b
...
...
@@ -4530,7 +4530,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core
/***/
(
function
(
module
,
__webpack_exports__
,
__webpack_require__
)
{
"use strict"
;
eval
(
"__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.11@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.9.3@vant/es/index.js\");\n/* harmony import */ var _api_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../api/index */ \"./src/api/index.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../util */ \"./src/util/index.js\");\n\n\n\n\n\nvar qs = __webpack_require__(/*! qs */ \"./node_modules/_qs@6.9.4@qs/lib/index.js\");\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"]);\nvar state = {\n loading: false,\n addressInfo: \"\",\n submitState: false,\n ypGoodDetail: {},\n ypComInfo: {},\n ypBasInfo: {},\n ordernum: ''\n};\nvar mutations = {\n recvlistSample: function recvlistSample(state, payload) {\n if (!payload.data) {\n state.addressInfo = null;\n } else {\n state.addressInfo = payload.data.filter(function (item) {\n return item['is_default'] == 1;\n });\n state.addressInfo = state.addressInfo[0];\n }\n }\n};\nvar actions = {\n recvlistSample: function recvlistSample(_ref, payload) {\n var commit = _ref.commit;\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].recvlist().then(function (res) {\n var data = res.data; // state.loading = false;\n\n console.log(data.err_code);\n\n if (data.err_code == 0) {\n commit({\n type: 'recvlistSample',\n data: data.data\n });\n } else {\n commit({\n type: 'recvlistSample',\n data: null\n });\n }\n }).catch(function (err) {});\n },\n selfSampleCreate: function selfSampleCreate(_ref2, payload) {\n var commit = _ref2.commit;\n state.loading = true;\n var params = payload.data;\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].selfSampleCreate(qs.stringify(params)).then(function (res) {\n var data = res.data;\n state.loading = false;\n\n if (data.err_code == 0) {\n state.submitState = true;\n state.ordernum = data.data || '';\n } else if (data.err_code == '40014') {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])('样品库存不足');\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])(data.err_msg);\n }\n }).catch(function (err) {\n state.loading = false;\n });\n },\n getDetailYp: function getDetailYp(_ref3, payload) {\n var commit = _ref3.commit;\n state.loading = true;\n
var Params_ = {\n id: payload.data.id\n };
\n var params = _util__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getParams(Params_);\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].getSampleInfo(params).then(function (res) {\n var data = res.data;\n state.loading = false;\n\n if (data.err_code == 0) {\n state.ypGoodDetail = data.data.goods_info || {};\n state.ypComInfo = data.data.company_info || {};\n state.ypBasInfo = data.data.user_info || {};\n }\n }).catch(function (err) {\n state.loading = false;\n });\n }\n};\nvar getters = {};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n actions: actions,\n getters: getters\n});\n\n//# sourceURL=webpack:///./src/store/modules/sample/sampleapply.js?"
);
eval
(
"__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.11@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.9.3@vant/es/index.js\");\n/* harmony import */ var _api_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../api/index */ \"./src/api/index.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../util */ \"./src/util/index.js\");\n\n\n\n\n\nvar qs = __webpack_require__(/*! qs */ \"./node_modules/_qs@6.9.4@qs/lib/index.js\");\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"]);\nvar state = {\n loading: false,\n addressInfo: \"\",\n submitState: false,\n ypGoodDetail: {},\n ypComInfo: {},\n ypBasInfo: {},\n ordernum: ''\n};\nvar mutations = {\n recvlistSample: function recvlistSample(state, payload) {\n if (!payload.data) {\n state.addressInfo = null;\n } else {\n state.addressInfo = payload.data.filter(function (item) {\n return item['is_default'] == 1;\n });\n state.addressInfo = state.addressInfo[0];\n }\n }\n};\nvar actions = {\n recvlistSample: function recvlistSample(_ref, payload) {\n var commit = _ref.commit;\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].recvlist().then(function (res) {\n var data = res.data; // state.loading = false;\n\n console.log(data.err_code);\n\n if (data.err_code == 0) {\n commit({\n type: 'recvlistSample',\n data: data.data\n });\n } else {\n commit({\n type: 'recvlistSample',\n data: null\n });\n }\n }).catch(function (err) {});\n },\n selfSampleCreate: function selfSampleCreate(_ref2, payload) {\n var commit = _ref2.commit;\n state.loading = true;\n var params = payload.data;\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].selfSampleCreate(qs.stringify(params)).then(function (res) {\n var data = res.data;\n state.loading = false;\n\n if (data.err_code == 0) {\n state.submitState = true;\n state.ordernum = data.data || '';\n } else if (data.err_code == '40014') {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])('样品库存不足');\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])(data.err_msg);\n }\n }).catch(function (err) {\n state.loading = false;\n });\n },\n getDetailYp: function getDetailYp(_ref3, payload) {\n var commit = _ref3.commit;\n state.loading = true;\n
\n if (payload.data.type) {\n var _Params_ = {\n id: payload.data.id,\n type: 2\n };\n } else {\n var _Params_2 = {\n id: payload.data.id\n };\n }\n
\n var params = _util__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getParams(Params_);\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].getSampleInfo(params).then(function (res) {\n var data = res.data;\n state.loading = false;\n\n if (data.err_code == 0) {\n state.ypGoodDetail = data.data.goods_info || {};\n state.ypComInfo = data.data.company_info || {};\n state.ypBasInfo = data.data.user_info || {};\n }\n }).catch(function (err) {\n state.loading = false;\n });\n }\n};\nvar getters = {};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n actions: actions,\n getters: getters\n});\n\n//# sourceURL=webpack:///./src/store/modules/sample/sampleapply.js?"
);
/***/
}),
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment