Files
T
陈誉午 994b267f5c feat: 电子药箱小程序 - 4Tab药品管理
- 电子药箱: 药品库存管理 + 手动录入 + 今日用药打卡
- 药品百科: 搜索 + 分类筛选 + 20种药品静态数据
- 惠教中心: 4条药品使用指南课程
- 我的: 家庭成员信息管理
- 自定义TabBar + navigation-bar组件
- SVG药品分类插图
2026-07-29 11:20:52 +08:00

1 line
15 KiB
JavaScript

"use strict";var _constant=require("../../../../utils/constant"),_jump=require("../../../../utils/jump");function _regeneratorRuntime(){_regeneratorRuntime=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,o){var a=e&&e.prototype instanceof d?e:d,i=Object.create(a.prototype),c=new j(o||[]);return n(i,"_invoke",{value:_(t,r,c)}),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f={};function d(){}function h(){}function y(){}var p={};u(p,a,function(){return this});var v=Object.getPrototypeOf,m=v&&v(v(I([])));m&&m!==e&&r.call(m,a)&&(p=m);var g=y.prototype=d.prototype=Object.create(p);function b(t){["next","throw","return"].forEach(function(e){u(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function o(n,a,i,c){var u=l(t[n],t,a);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==_typeof(f)&&r.call(f,"__await")?e.resolve(f.__await).then(function(t){o("next",t,i,c)},function(t){o("throw",t,i,c)}):e.resolve(f).then(function(t){s.value=t,i(s)},function(t){return o("throw",t,i,c)})}c(u.arg)}var a;n(this,"_invoke",{value:function(t,r){function n(){return new e(function(e,n){o(t,r,e,n)})}return a=a?a.then(n,n):n()}})}function _(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=E(i,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var a=o.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function I(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=y,n(g,"constructor",{value:y,configurable:!0}),n(y,"constructor",{value:h,configurable:!0}),h.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},b(w.prototype),u(w.prototype,i,function(){return this}),t.AsyncIterator=w,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new w(s(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(g),u(g,c,"Generator"),u(g,a,function(){return this}),u(g,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=I,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:I(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function asyncGeneratorStep(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){asyncGeneratorStep(a,n,o,i,c,"next",t)}function c(t){asyncGeneratorStep(a,n,o,i,c,"throw",t)}i(void 0)})}}function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(t,e){if("object"!==_typeof(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,c=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return c}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}var stringifyUrl=function(t){var e=t.url,r=t.query,n=String(e||"");if(!r||"object"!==_typeof(r))return n;var o=Object.keys(r);if(!o.length)return n;var a=[];if(o.forEach(function(t){var e=r[t];if(null!=e){var n=encodeURIComponent(t);Array.isArray(e)?e.forEach(function(t){null!=t&&a.push("".concat(n,"=").concat(encodeURIComponent(String(t))))}):a.push("".concat(n,"=").concat(encodeURIComponent(String(e))))}}),!a.length)return n;var i=_slicedToArray(n.split("#"),2),c=i[0],u=i[1],s=c.includes("?")?"&":"?",l=a.join("&");return"".concat(c).concat(s).concat(l).concat(u?"#".concat(u):"")};Component({options:{styleIsolation:"shared"},properties:{sdkInstance:{type:Object,value:null},IsUseDarkTheme:{type:Boolean,value:null},data:{type:Object,value:null},status:{type:Number,value:null},visible:{type:Boolean,value:null},type:{type:String,value:null}},data:{receiverNameError:!1,telError:!1,telEmptyError:!1,addressError:!1,regionArray:null===_constant.RegionArray||void 0===_constant.RegionArray?void 0:_constant.RegionArray.map(function(t){return t.label}),formData:{address:"",region:35,tel:"",receiverName:"",email:""},isSubmitDisabled:!1,isFormEdit:!1,showAwardList:!1},observers:{sdkInstance:function(t){if(t){this.store=t.store,this.sdkInstance=t;var e=this;t.on(_constant.EVENTS.INNER.socket.init,function(t){e.socket=t})}},data:function(t){var e=this;if(t){var r=_slicedToArray(t.AwardTel?this.getRegionAndPhoneByMobile(t.AwardTel):[],2),n=r[0],o=void 0===n?"+86":n,a=r[1];this.setData({formData:_objectSpread(_objectSpread({},this.data.formData),{},{address:t.AwardAddress,region:_constant.RegionArray.findIndex(function(t){return t.value===o}),tel:a||"",receiverName:t.ReceiverName})},function(){e.valueChange()})}}},methods:{onTicketGo:function(){var t,e,r,n,o=this.store.get("mainInfo").activityId,a=this.data.data.ID,i=stringifyUrl({url:this.data.data.AwardLotteryTicketAddr,query:{ActivityId:o,TaskAwardId:a}});null===(t=this.sdkInstance)||void 0===t||null===(e=t.reportTea)||void 0===e||e.call(t,"lottery_ticket_click",{terminal:"miniprogram",evModule:"award",ActivityId:o,url:i,TaskAwardId:a}),null===(r=this.sdkInstance)||void 0===r||null===(n=r.emit)||void 0===n||n.call(r,_constant.EVENTS.PUBLIC.lottery.ticketClick,{url:i,ActivityId:o,TaskAwardId:a}),(0,_jump.navigateToConfiguredWebview)(this.sdkInstance,_jump.JUMP_FEATURES.LOTTERY_TICKET,i)},checkLotteryList:function(){this.setData({showAwardList:!0})},closeLotteryList:function(){this.setData({showAwardList:!1})},closeModal:function(){(this.store.get("AwardInfo")||{}).visible&&this.store.set("AwardInfo",{visible:!1,currentId:null}),this.setData({isSubmitDisabled:!1,isFormEdit:!1,showAwardList:!1,receiverNameError:!1,telError:!1,telEmptyError:!1,addressError:!1})},editClick:function(){this.setData({isFormEdit:!0})},formReceiverNameChange:function(t){var e,r=this,n=t.detail.value;this.setData((_defineProperty(e={},"formData.receiverName",n),_defineProperty(e,"receiverNameError",!n),e),function(){r.valueChange()})},formRegionChange:function(t){var e=this,r=t.detail.value;this.setData(_defineProperty({},"formData.region",r),function(){e.valueChange()})},formTelChange:function(t){var e,r=this,n=t.detail.value;this.setData((_defineProperty(e={},"formData.tel",n),_defineProperty(e,"telError",!1),_defineProperty(e,"telEmptyError",!n),e),function(){r.valueChange()})},formEmailChange:function(t){var e,r=this,n=t.detail.value;this.setData((_defineProperty(e={},"formData.email",n),_defineProperty(e,"emailError",!1),_defineProperty(e,"emailEmptyError",!n),e),function(){r.valueChange()})},formAddressChange:function(t){var e,r=this,n=t.detail.value;this.setData((_defineProperty(e={},"formData.address",n),_defineProperty(e,"addressError",!n),e),function(){r.valueChange()})},valueChange:function(){var t=this.data.formData,e=t.address,r=t.region,n=t.tel,o=t.receiverName,a=t.email,i=this.data.data.showReceiverName&&!o||this.data.data.showAddress&&!e||this.data.data.showMobile&&(!r||!n)||this.data.data.showEmail&&!a;this.setData({isSubmitDisabled:i})},getRegionAndPhoneByMobile:function(t){if(!t.includes("+"))return["+86",t];for(var e=0;e<_constant.RegionArray.length;e++){var r="".concat(_constant.RegionArray[e].value);if(0===t.indexOf(r))return[t.slice(0,r.length),t.slice(r.length)]}return console.error("无效的手机号:",t),[]},onPersonalInfoOk:function(){var t=this;return _asyncToGenerator(_regeneratorRuntime().mark(function e(){var r,n,o,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.store.get("mainInfo"),n=r.activityId,o={ActivityID:n,AwardID:t.data.data.ID,AwardAddress:t.data.formData.address,AwardEmail:t.data.formData.email,ReceiverName:t.data.formData.receiverName},!t.data.data.showMobile){e.next=8;break}if(a="".concat(_constant.RegionArray[t.data.formData.region].value).concat(t.data.formData.tel),/^([0|+[0-9]{1,5})?([0-9]{10})$/.test(a)){e.next=7;break}return t.setData({telError:!0}),e.abrupt("return");case 7:o.AwardTel=a;case 8:return e.next=10,t.sdkInstance.request(_constant.REQUEST_URL_MAP.UPDATE_AWARD_RECORD_INFO,{method:"POST",data:o}).catch(function(e){wx.showToast({title:"发生错误请重试",icon:"none"}),t.sdkInstance.reportLogger("lottery_fail_info",{params:_objectSpread(_objectSpread({},o),{},{evModule:"LOTTERY"})})});case 10:e.sent&&(t.closeModal(),wx.showToast({title:"提交成功",icon:"none"}));case 12:case"end":return e.stop()}},e)}))()}}});