Commit 1b99626e by 施宇

地址的bug修复

parent c3ef0d6e
...@@ -18,8 +18,13 @@ const state = { ...@@ -18,8 +18,13 @@ const state = {
} }
const mutations = { const mutations = {
recvlistSample(state, payload) { recvlistSample(state, payload) {
state.addressInfo=payload.data.filter(function(item){return item['is_default'] == 1;}); if(!payload.data){
state.addressInfo=state.addressInfo[0]; state.addressInfo = null
}else{
state.addressInfo=payload.data.filter(function(item){return item['is_default'] == 1;});
state.addressInfo=state.addressInfo[0];
}
}, },
} }
...@@ -28,11 +33,17 @@ const actions = { ...@@ -28,11 +33,17 @@ const actions = {
Services.recvlist().then((res) => { Services.recvlist().then((res) => {
let data = res.data; let data = res.data;
// state.loading = false; // state.loading = false;
console.log(data.err_code)
if (data.err_code == 0) { if (data.err_code == 0) {
commit({ commit({
type: 'recvlistSample', type: 'recvlistSample',
data: data.data data: data.data
}); });
}else{
commit({
type: 'recvlistSample',
data: null
});
} }
}).catch(function (err) { }).catch(function (err) {
}); });
......
...@@ -208,6 +208,7 @@ const actions = { ...@@ -208,6 +208,7 @@ const actions = {
setTimeout(function(){ setTimeout(function(){
if(payload.orderpg){ if(payload.orderpg){
history.go(-1); history.go(-1);
}else{ }else{
history.go(0); history.go(0);
} }
......
...@@ -385,7 +385,7 @@ export default { ...@@ -385,7 +385,7 @@ export default {
window.location.href = "/h5/view/#/userAddress?points=" + adderssId; window.location.href = "/h5/view/#/userAddress?points=" + adderssId;
}, },
adderssAdd() { adderssAdd() {
window.location.href = "/h5/view/#/userAddress?fp=5"; window.location.href = "/h5/view/#/userAddress";
}, },
}, },
components: { components: {
......
...@@ -125,9 +125,6 @@ ...@@ -125,9 +125,6 @@
iso:this.$route.query.fp,//是否开启新增 iso:this.$route.query.fp,//是否开启新增
address_id_p:this.$route.query.address_id, address_id_p:this.$route.query.address_id,
zytp:this.$route.query.zyType, zytp:this.$route.query.zyType,
//编辑 //编辑
tips:"", tips:"",
edOrAdd:false, edOrAdd:false,
......
...@@ -20,7 +20,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core ...@@ -20,7 +20,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core
/***/ (function(module, __webpack_exports__, __webpack_require__) { /***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict"; "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.4@@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.0@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//\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 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 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 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 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 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.sample_demand_desc) {\n Object(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"])(\"请填写项目描述\");\n return false;\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 (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?fp=5\";\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.4@@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.0@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//\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 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 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 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 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 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.sample_demand_desc) {\n Object(vant__WEBPACK_IMPORTED_MODULE_10__[\"Toast\"])(\"请填写项目描述\");\n return false;\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 (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");
/***/ }), /***/ }),
......
...@@ -4506,7 +4506,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core ...@@ -4506,7 +4506,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core
/***/ (function(module, __webpack_exports__, __webpack_require__) { /***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict"; "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.0@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 state.addressInfo = payload.data.filter(function (item) {\n return item['is_default'] == 1;\n });\n state.addressInfo = state.addressInfo[0];\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 if (data.err_code == 0) {\n commit({\n type: 'recvlistSample',\n data: data.data\n });\n }\n }).catch(function (err) {});\n },\n selfSampleCreate: function selfSampleCreate(_ref2, payload) {\n var commit = _ref2.commit;\n state.loading = true; // var params = {\n // goods_id: payload.goods_id,\n // apply_num: payload.apply_num,\n // com_name: payload.com_name,\n // sample_demand_desc: payload.sample_demand_desc,\n // address_id: payload.address_id\n // }\n\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 } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])(data.err_msg);\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.0@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; // var params = {\n // goods_id: payload.goods_id,\n // apply_num: payload.apply_num,\n // com_name: payload.com_name,\n // sample_demand_desc: payload.sample_demand_desc,\n // address_id: payload.address_id\n // }\n\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 } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])(data.err_msg);\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?");
/***/ }), /***/ }),
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 sign in to comment