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
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
23 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
...
...
@@ -9,20 +9,22 @@ Vue.use(Toast);
const
state
=
{
loading
:
false
,
addressInfo
:
""
,
submitState
:
false
,
ypGoodDetail
:
{},
ypComInfo
:
{},
ypBasInfo
:
{},
ordernum
:
''
addressInfo
:
""
,
submitState
:
false
,
ypGoodDetail
:
{},
ypComInfo
:
{},
ypBasInfo
:
{},
ordernum
:
''
}
const
mutations
=
{
recvlistSample
(
state
,
payload
)
{
if
(
!
payload
.
data
)
{
if
(
!
payload
.
data
)
{
state
.
addressInfo
=
null
}
else
{
state
.
addressInfo
=
payload
.
data
.
filter
(
function
(
item
){
return
item
[
'is_default'
]
==
1
;});
state
.
addressInfo
=
state
.
addressInfo
[
0
];
}
else
{
state
.
addressInfo
=
payload
.
data
.
filter
(
function
(
item
)
{
return
item
[
'is_default'
]
==
1
;
});
state
.
addressInfo
=
state
.
addressInfo
[
0
];
}
},
...
...
@@ -39,7 +41,7 @@ const actions = {
type
:
'recvlistSample'
,
data
:
data
.
data
});
}
else
{
}
else
{
commit
({
type
:
'recvlistSample'
,
data
:
null
...
...
@@ -56,11 +58,11 @@ const actions = {
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'
)
{
state
.
submitState
=
true
;
state
.
ordernum
=
data
.
data
||
''
}
else
if
(
data
.
err_code
==
'40014'
)
{
Toast
(
'样品库存不足'
);
}
else
{
}
else
{
Toast
(
data
.
err_msg
);
}
}).
catch
(
function
(
err
)
{
...
...
@@ -69,17 +71,27 @@ const actions = {
},
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
||
{}
state
.
ypGoodDetail
=
data
.
data
.
goods_info
||
{}
state
.
ypComInfo
=
data
.
data
.
company_info
||
{}
state
.
ypBasInfo
=
data
.
data
.
user_info
||
{}
}
}).
catch
(
function
(
err
)
{
state
.
loading
=
false
;
...
...
src/views/sample/sampleapply.vue
View file @
df3b4f8b
...
...
@@ -230,16 +230,30 @@
this
.
isShowComInfo
=
true
;
}
}
}
this
.
$store
.
dispatch
({
type
:
"getDetailYp"
,
data
:
{
id
:
this
.
goods_id
},
data
:
{
type
:
'spacial'
,
id
:
this
.
goods_id
}
});
}
else
{
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
...
...
@@ -20,7 +20,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 core_js_modules_es7_object_get_own_property_descriptors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es7.object.get-own-property-descriptors */ \"./node_modules/_core-js@2.6.11@core-js/modules/es7.object.get-own-property-descriptors.js\");\n/* harmony import */ var core_js_modules_es7_object_get_own_property_descriptors__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es7_object_get_own_property_descriptors__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/web.dom.iterable */ \"./node_modules/_core-js@2.6.11@core-js/modules/web.dom.iterable.js\");\n/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es6.array.iterator */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.array.iterator.js\");\n/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es6.object.keys */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.object.keys.js\");\n/* harmony import */ var core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.regexp.replace.js\");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var E_h5_node_modules_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/defineProperty */ \"./node_modules/_@babel_runtime@7.10.5@@babel/runtime/helpers/esm/defineProperty.js\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.11@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vuex */ \"./node_modules/_vuex@3.5.1@vuex/dist/vuex.esm.js\");\n/* harmony import */ var _views_common_Header_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/views/common/Header.vue */ \"./src/views/common/Header.vue\");\n/* harmony import */ var _views_common_wxShare_vue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/views/common/wxShare.vue */ \"./src/views/common/wxShare.vue\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.9.3@vant/es/index.js\");\n/* harmony import */ var _util_index__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../util/index */ \"./src/util/index.js\");\n\n\n\n\n\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(E_h5_node_modules_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_6__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_10__[\"Collapse\"]).use(vant__WEBPACK_IMPORTED_MODULE_10__[\"CollapseItem\"]).use(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"]).use(vant__WEBPACK_IMPORTED_MODULE_10__[\"Loading\"]);\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: \"sampleapply\",\n data: function data() {\n return {\n title: \"样片申请\",\n meaushow: true,\n bgcolor: \"#fafafa\",\n color: \"#1080d0\",\n activeName: \"1\",\n noborder: false,\n successPop: false,\n //申请成功弹窗显示\n goods_id: this.$route.query.id,\n apply_num: \"\",\n com_name: \"\",\n sample_demand_desc: \"\",\n sbs: false,\n shareUrl: window.location.origin + \"/v3/samplereg?uid=\" + _util_index__WEBPACK_IMPORTED_MODULE_11__[\"default\"].getCookie(\"Yo4teW_uid\"),\n isShowComName: false,\n isShowBasInfo: false,\n isShowComInfo: false,\n occupationType: this.$route.query.type || -1,\n from: this.$route.query.from || '',\n fullType: this.$route.query.full || -1,\n //0表示未填写完整 1表示填写完整\n cominfocookie: localStorage.getItem(\"samplecominfo\") || \"\",\n basinfocookie: localStorage.getItem(\"samplebasinfo\") || \"\"\n };\n },\n computed: _objectSpread({}, Object(vuex__WEBPACK_IMPORTED_MODULE_7__[\"mapState\"])({\n loading: function loading(state) {\n return state.sampleapply.loading;\n },\n addressInfo: function addressInfo(state) {\n return state.sampleapply.addressInfo;\n },\n ypGoodDetail: function ypGoodDetail(state) {\n return state.sampleapply.ypGoodDetail;\n },\n ypComInfo: function ypComInfo(state) {\n return state.sampleapply.ypComInfo;\n },\n ypBasInfo: function ypBasInfo(state) {\n return state.sampleapply.ypBasInfo;\n },\n submitState: function submitState(state) {\n return state.sampleapply.submitState;\n },\n ordernum: function ordernum(state) {\n return state.sampleapply.ordernum;\n }\n })),\n watch: {\n ypGoodDetail: function ypGoodDetail(val) {\n var type = this.occupationType;\n var full = this.fullType;\n var num = val.max_number;\n\n if (!num) {\n this.apply_num = 1;\n } else {\n this.apply_num = num;\n }\n\n full == 0 && this.fillData();\n\n if (full == 0) {\n if (type == 4 || type == 7) {\n this.isShowComName = true;\n } else if (type == 1 || type == 8) {\n this.isShowBasInfo = true;\n this.isShowComInfo = true;\n }\n }\n },\n submitState: function submitState(val) {\n if (val) {\n if (this.from) {\n this.sbs = true;\n }\n\n this.successPop = true;\n }\n }\n },\n beforeRouteEnter: function beforeRouteEnter(to, from, next) {\n if (from.path != \"/samplebasinfo\" && from.path != \"/samplecominfo\") {\n localStorage.removeItem(\"samplebasinfo\");\n localStorage.removeItem(\"samplecominfo\");\n localStorage.removeItem(\"sampledesc\");\n }\n\n next();\n },\n created: function created() {\n if (this.from) {\n var full = this.fullType;\n var type = this.occupationType;\n\n if (full == 0) {\n if (type == 4 || type == 7) {\n this.isShowComName = true;\n } else if (type == 1 || type == 8) {\n this.isShowBasInfo = true;\n this.isShowComInfo = true;\n }\n }\n
}\n\n this.$store.dispatch({\n type: \"getDetailYp\",\n data: {\n id: this.goods_id\n }\n });
\n this.$store.dispatch({\n type: \"recvlistSample\"\n }); //这里把项目需求的描述放到缓存里面,切换页面的时候缓存起来\n\n var sampledesccookie = localStorage.getItem(\"sampledesc\") || \"\";\n\n if (sampledesccookie) {\n this.sample_demand_desc = sampledesccookie;\n }\n },\n methods: {\n url: function url() {\n this.$router.replace(\"/sample/special\"); // window.location.href='/#/sample/special';\n },\n descCookie: function descCookie() {\n if (this.sample_demand_desc) {\n localStorage.setItem(\"sampledesc\", this.sample_demand_desc);\n }\n },\n toBasicInfo: function toBasicInfo() {\n //去基础信息页面\n this.descCookie();\n this.$router.push({\n path: \"/samplebasinfo\",\n query: {\n type: this.occupationType,\n full: this.fullType\n }\n });\n },\n toComInfo: function toComInfo() {\n //去公司信息页面\n //去基础信息页面\n this.descCookie();\n this.$router.push({\n path: \"/samplecominfo\",\n query: {\n type: this.occupationType,\n full: this.fullType\n }\n });\n },\n fillData: function fillData() {\n //数据填充\n this.com_name = this.ypComInfo.com_name || \"\";\n },\n toUrl: function toUrl() {\n // window.location.href = \"/h5/view/#/sample\";\n this.$router.replace(\"/sample\");\n },\n getuserf: function getuserf() {\n this.successPop = false;\n window.location.href = \"/v3/user/order\";\n },\n validateForm: function validateForm() {\n var type = this.occupationType;\n var full = this.fullType;\n\n if ((type == 4 || type == 7) && full == 0) {\n //学生并且未填\n if (!this.com_name) {\n Object(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"])(\"请输入单位名称\");\n return false;\n }\n }\n\n if (!this.from) {\n if (!this.sample_demand_desc) {\n Object(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"])(\"请填写项目描述\");\n return false;\n }\n }\n\n if ((type == 1 || type == 8) && full == 0) {\n //非学生并且未填\n //1 判断基本信息是否填写完成\n var basicInfo = this.ypBasInfo;\n var comInfo = this.ypComInfo;\n\n if (basicInfo.mobile && basicInfo.user_name && basicInfo.email || this.basinfocookie) {} else {\n Object(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"])(\"基本信息未填写完成\");\n return false;\n }\n\n if (comInfo.com_name && comInfo.com_telphone && comInfo.type_id && comInfo.com_province_id && comInfo.com_address && comInfo.comPic || this.cominfocookie) {} else {\n Object(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"])(\"公司信息未填写完成\");\n return false;\n }\n }\n\n return true;\n },\n formDataDeal: function formDataDeal() {\n //表单数据处理\n var self = this;\n\n if (!this.validateForm()) {\n return false;\n }\n\n var type = this.occupationType;\n var full = this.fullType;\n var basicInfo = this.ypBasInfo; //请求获得的数据(基本信息)\n\n var comInfo = this.ypComInfo; //请求获得的数据(公司信息)\n\n var basicInfoCookie = this.basinfocookie ? JSON.parse(this.basinfocookie) : {}; //缓存的数据(基本信息)\n\n var comInfoCookie = this.cominfocookie ? JSON.parse(this.cominfocookie) : {}; //缓存的数据(公司信息)\n\n var obj = {\n goods_id: self.goods_id,\n apply_num: self.apply_num,\n sample_demand_desc: self.sample_demand_desc,\n address_id: self.addressInfo.address_id\n };\n\n if (this.from) {\n obj[\"type\"] = 2;\n }\n\n if (type != -1) {\n obj[\"user_info[work_function]\"] = type;\n }\n\n if (full == 0) {\n if (type == 4 || type == 7) {\n obj[\"company_info[com_name]\"] = this.com_name;\n } else if (type == 1 || type == 8) {\n //1-工程师,4-学生,7-贸易商,8-终端商\n obj[\"user_basic[mobile]\"] = basicInfo.mobile || basicInfoCookie.mobile;\n obj[\"user_basic[email]\"] = basicInfo.email || basicInfoCookie.email;\n obj[\"user_basic[user_name]\"] = basicInfo.user_name || basicInfoCookie.user_name;\n obj[\"user_info[work_card]\"] = comInfo.comPic || comInfoCookie.com_pic;\n obj[\"company_info[com_name]\"] = comInfo.com_name || comInfoCookie.com_name_1;\n obj[\"company_info[type_id]\"] = comInfo.type_id || comInfoCookie.com_nature;\n obj[\"company_info[com_telphone]\"] = comInfo.com_telphone || comInfoCookie.phone;\n obj[\"company_info[com_province_id]\"] = comInfo.com_province_id || comInfoCookie.province_id;\n obj[\"company_info[com_city_id]\"] = comInfo.com_city_id || comInfoCookie.city_id;\n obj[\"company_info[com_area_id]\"] = comInfo.com_area_id || comInfoCookie.area_id;\n obj[\"company_info[com_address]\"] = comInfo.com_address || comInfoCookie.com_detail_add;\n }\n }\n\n return obj;\n },\n submitS: function submitS() {\n var obj = this.formDataDeal();\n\n if (!obj) {\n return;\n }\n\n console.log(obj);\n this.$store.dispatch({\n type: \"selfSampleCreate\",\n data: obj\n });\n },\n addressSample: function addressSample(adderssId) {\n window.location.href = \"/h5/view/#/userAddress?points=\" + adderssId;\n },\n adderssAdd: function adderssAdd() {\n window.location.href = \"/h5/view/#/userAddress\";\n }\n },\n components: {\n Header: _views_common_Header_vue__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n wxShare: _views_common_wxShare_vue__WEBPACK_IMPORTED_MODULE_9__[\"default\"]\n }\n});\n\n//# sourceURL=webpack:///./src/views/sample/sampleapply.vue?./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_babel-loader@8.1.0@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options"
);
eval
(
"__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es7_object_get_own_property_descriptors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es7.object.get-own-property-descriptors */ \"./node_modules/_core-js@2.6.11@core-js/modules/es7.object.get-own-property-descriptors.js\");\n/* harmony import */ var core_js_modules_es7_object_get_own_property_descriptors__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es7_object_get_own_property_descriptors__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/web.dom.iterable */ \"./node_modules/_core-js@2.6.11@core-js/modules/web.dom.iterable.js\");\n/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es6.array.iterator */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.array.iterator.js\");\n/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es6.object.keys */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.object.keys.js\");\n/* harmony import */ var core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.regexp.replace.js\");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var E_h5_node_modules_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/defineProperty */ \"./node_modules/_@babel_runtime@7.10.5@@babel/runtime/helpers/esm/defineProperty.js\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.11@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vuex */ \"./node_modules/_vuex@3.5.1@vuex/dist/vuex.esm.js\");\n/* harmony import */ var _views_common_Header_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/views/common/Header.vue */ \"./src/views/common/Header.vue\");\n/* harmony import */ var _views_common_wxShare_vue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/views/common/wxShare.vue */ \"./src/views/common/wxShare.vue\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.9.3@vant/es/index.js\");\n/* harmony import */ var _util_index__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../util/index */ \"./src/util/index.js\");\n\n\n\n\n\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(E_h5_node_modules_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_6__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_10__[\"Collapse\"]).use(vant__WEBPACK_IMPORTED_MODULE_10__[\"CollapseItem\"]).use(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"]).use(vant__WEBPACK_IMPORTED_MODULE_10__[\"Loading\"]);\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: \"sampleapply\",\n data: function data() {\n return {\n title: \"样片申请\",\n meaushow: true,\n bgcolor: \"#fafafa\",\n color: \"#1080d0\",\n activeName: \"1\",\n noborder: false,\n successPop: false,\n //申请成功弹窗显示\n goods_id: this.$route.query.id,\n apply_num: \"\",\n com_name: \"\",\n sample_demand_desc: \"\",\n sbs: false,\n shareUrl: window.location.origin + \"/v3/samplereg?uid=\" + _util_index__WEBPACK_IMPORTED_MODULE_11__[\"default\"].getCookie(\"Yo4teW_uid\"),\n isShowComName: false,\n isShowBasInfo: false,\n isShowComInfo: false,\n occupationType: this.$route.query.type || -1,\n from: this.$route.query.from || '',\n fullType: this.$route.query.full || -1,\n //0表示未填写完整 1表示填写完整\n cominfocookie: localStorage.getItem(\"samplecominfo\") || \"\",\n basinfocookie: localStorage.getItem(\"samplebasinfo\") || \"\"\n };\n },\n computed: _objectSpread({}, Object(vuex__WEBPACK_IMPORTED_MODULE_7__[\"mapState\"])({\n loading: function loading(state) {\n return state.sampleapply.loading;\n },\n addressInfo: function addressInfo(state) {\n return state.sampleapply.addressInfo;\n },\n ypGoodDetail: function ypGoodDetail(state) {\n return state.sampleapply.ypGoodDetail;\n },\n ypComInfo: function ypComInfo(state) {\n return state.sampleapply.ypComInfo;\n },\n ypBasInfo: function ypBasInfo(state) {\n return state.sampleapply.ypBasInfo;\n },\n submitState: function submitState(state) {\n return state.sampleapply.submitState;\n },\n ordernum: function ordernum(state) {\n return state.sampleapply.ordernum;\n }\n })),\n watch: {\n ypGoodDetail: function ypGoodDetail(val) {\n var type = this.occupationType;\n var full = this.fullType;\n var num = val.max_number;\n\n if (!num) {\n this.apply_num = 1;\n } else {\n this.apply_num = num;\n }\n\n full == 0 && this.fillData();\n\n if (full == 0) {\n if (type == 4 || type == 7) {\n this.isShowComName = true;\n } else if (type == 1 || type == 8) {\n this.isShowBasInfo = true;\n this.isShowComInfo = true;\n }\n }\n },\n submitState: function submitState(val) {\n if (val) {\n if (this.from) {\n this.sbs = true;\n }\n\n this.successPop = true;\n }\n }\n },\n beforeRouteEnter: function beforeRouteEnter(to, from, next) {\n if (from.path != \"/samplebasinfo\" && from.path != \"/samplecominfo\") {\n localStorage.removeItem(\"samplebasinfo\");\n localStorage.removeItem(\"samplecominfo\");\n localStorage.removeItem(\"sampledesc\");\n }\n\n next();\n },\n created: function created() {\n if (this.from) {\n var full = this.fullType;\n var type = this.occupationType;\n\n if (full == 0) {\n if (type == 4 || type == 7) {\n this.isShowComName = true;\n } else if (type == 1 || type == 8) {\n this.isShowBasInfo = true;\n this.isShowComInfo = true;\n }\n }\n
\n this.$store.dispatch({\n type: \"getDetailYp\",\n data: {\n type: 'spacial',\n id: this.goods_id\n }\n });\n } else {\n this.$store.dispatch({\n type: \"getDetailYp\",\n data: {\n id: this.goods_id\n }\n });\n }\n
\n this.$store.dispatch({\n type: \"recvlistSample\"\n }); //这里把项目需求的描述放到缓存里面,切换页面的时候缓存起来\n\n var sampledesccookie = localStorage.getItem(\"sampledesc\") || \"\";\n\n if (sampledesccookie) {\n this.sample_demand_desc = sampledesccookie;\n }\n },\n methods: {\n url: function url() {\n this.$router.replace(\"/sample/special\"); // window.location.href='/#/sample/special';\n },\n descCookie: function descCookie() {\n if (this.sample_demand_desc) {\n localStorage.setItem(\"sampledesc\", this.sample_demand_desc);\n }\n },\n toBasicInfo: function toBasicInfo() {\n //去基础信息页面\n this.descCookie();\n this.$router.push({\n path: \"/samplebasinfo\",\n query: {\n type: this.occupationType,\n full: this.fullType\n }\n });\n },\n toComInfo: function toComInfo() {\n //去公司信息页面\n //去基础信息页面\n this.descCookie();\n this.$router.push({\n path: \"/samplecominfo\",\n query: {\n type: this.occupationType,\n full: this.fullType\n }\n });\n },\n fillData: function fillData() {\n //数据填充\n this.com_name = this.ypComInfo.com_name || \"\";\n },\n toUrl: function toUrl() {\n // window.location.href = \"/h5/view/#/sample\";\n this.$router.replace(\"/sample\");\n },\n getuserf: function getuserf() {\n this.successPop = false;\n window.location.href = \"/v3/user/order\";\n },\n validateForm: function validateForm() {\n var type = this.occupationType;\n var full = this.fullType;\n\n if ((type == 4 || type == 7) && full == 0) {\n //学生并且未填\n if (!this.com_name) {\n Object(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"])(\"请输入单位名称\");\n return false;\n }\n }\n\n if (!this.from) {\n if (!this.sample_demand_desc) {\n Object(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"])(\"请填写项目描述\");\n return false;\n }\n }\n\n if ((type == 1 || type == 8) && full == 0) {\n //非学生并且未填\n //1 判断基本信息是否填写完成\n var basicInfo = this.ypBasInfo;\n var comInfo = this.ypComInfo;\n\n if (basicInfo.mobile && basicInfo.user_name && basicInfo.email || this.basinfocookie) {} else {\n Object(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"])(\"基本信息未填写完成\");\n return false;\n }\n\n if (comInfo.com_name && comInfo.com_telphone && comInfo.type_id && comInfo.com_province_id && comInfo.com_address && comInfo.comPic || this.cominfocookie) {} else {\n Object(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"])(\"公司信息未填写完成\");\n return false;\n }\n }\n\n return true;\n },\n formDataDeal: function formDataDeal() {\n //表单数据处理\n var self = this;\n\n if (!this.validateForm()) {\n return false;\n }\n\n var type = this.occupationType;\n var full = this.fullType;\n var basicInfo = this.ypBasInfo; //请求获得的数据(基本信息)\n\n var comInfo = this.ypComInfo; //请求获得的数据(公司信息)\n\n var basicInfoCookie = this.basinfocookie ? JSON.parse(this.basinfocookie) : {}; //缓存的数据(基本信息)\n\n var comInfoCookie = this.cominfocookie ? JSON.parse(this.cominfocookie) : {}; //缓存的数据(公司信息)\n\n var obj = {\n goods_id: self.goods_id,\n apply_num: self.apply_num,\n sample_demand_desc: self.sample_demand_desc,\n address_id: self.addressInfo.address_id\n };\n\n if (this.from) {\n obj[\"type\"] = 2;\n }\n\n if (type != -1) {\n obj[\"user_info[work_function]\"] = type;\n }\n\n if (full == 0) {\n if (type == 4 || type == 7) {\n obj[\"company_info[com_name]\"] = this.com_name;\n } else if (type == 1 || type == 8) {\n //1-工程师,4-学生,7-贸易商,8-终端商\n obj[\"user_basic[mobile]\"] = basicInfo.mobile || basicInfoCookie.mobile;\n obj[\"user_basic[email]\"] = basicInfo.email || basicInfoCookie.email;\n obj[\"user_basic[user_name]\"] = basicInfo.user_name || basicInfoCookie.user_name;\n obj[\"user_info[work_card]\"] = comInfo.comPic || comInfoCookie.com_pic;\n obj[\"company_info[com_name]\"] = comInfo.com_name || comInfoCookie.com_name_1;\n obj[\"company_info[type_id]\"] = comInfo.type_id || comInfoCookie.com_nature;\n obj[\"company_info[com_telphone]\"] = comInfo.com_telphone || comInfoCookie.phone;\n obj[\"company_info[com_province_id]\"] = comInfo.com_province_id || comInfoCookie.province_id;\n obj[\"company_info[com_city_id]\"] = comInfo.com_city_id || comInfoCookie.city_id;\n obj[\"company_info[com_area_id]\"] = comInfo.com_area_id || comInfoCookie.area_id;\n obj[\"company_info[com_address]\"] = comInfo.com_address || comInfoCookie.com_detail_add;\n }\n }\n\n return obj;\n },\n submitS: function submitS() {\n var obj = this.formDataDeal();\n\n if (!obj) {\n return;\n }\n\n console.log(obj);\n this.$store.dispatch({\n type: \"selfSampleCreate\",\n data: obj\n });\n },\n addressSample: function addressSample(adderssId) {\n window.location.href = \"/h5/view/#/userAddress?points=\" + adderssId;\n },\n adderssAdd: function adderssAdd() {\n window.location.href = \"/h5/view/#/userAddress\";\n }\n },\n components: {\n Header: _views_common_Header_vue__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n wxShare: _views_common_wxShare_vue__WEBPACK_IMPORTED_MODULE_9__[\"default\"]\n }\n});\n\n//# sourceURL=webpack:///./src/views/sample/sampleapply.vue?./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_babel-loader@8.1.0@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options"
);
/***/
}),
...
...
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