|
楼主 |
发表于 2020-3-12 17:43:57
|
显示全部楼层
本帖最后由 Bex5wenti 于 2020-3-12 17:45 编辑
- define(function(require){
- var $ = require("jquery");
- var justep = require("$UI/system/lib/justep");
- var request = require("$UI/common/js/request");
-
- require("cordova!cordova-plugin-camera");
- require("cordova!cordova-plugin-file-transfer");
- //用common引入文件,做一个中间值的效果,然后调用common.去找到具体的值来引用
- var common = require("$UI/common/js/common");
- var docServer = common.constant.docServer;
- var input = require("$UI/system/components/justep/input/input");
- // swiper
- var Swiper = require("$UI/common/js/Swiper-4.0.5/js/swiper.min");
- require("css!$UI/common/js/Swiper-4.0.5/css/swiper.min").load();
- // layer
- require("$UI/common/js/layer_mobile/layer");
- require("css!$UI/common/js/layer_mobile/need/layer").load();
- var layer = window.layer;
-
- var input = require("$UI/system/components/justep/input/input");
-
- var Model = function(){
- this.callParent();
- this._id = "";
- this._ne = "new";
- this._payType = justep.Bind.observable([{"value":"网购订单"},{"value":"同城外卖"}]);
- this._type = justep.Bind.observable();
-
- this._tagI = 1; //标签初始是1,可以不填,之后再判断,修改进来的就也是改值
- this._tag = ""; //标签
-
- this._bannerI = 1; //banner默认要有最少一个
- this._bannerList = justep.Bind.observable("");
- this._upImageType = "";
- this._banner = "";
- this._detail = justep.Bind.observable("");
-
- this._sizeI = justep.Bind.observable(1); //原有的就1个 size,oldPrice,price,vipPrice,weight
- };
-
- //删除最新创建的五个input,如果this._sizeI=1不可以继续删除 this._sizeI.get()
- Model.prototype.subSizeClick = function(event){
- if(this._sizeI.get() > 1){
- // size oldPrice price vipPrice weight
- var dom1 = this.getElementByXid('size'+this._sizeI.get());
- var dom2 = this.getElementByXid('oldPrice'+this._sizeI.get());
- var dom3 = this.getElementByXid('price'+this._sizeI.get());
- var dom4 = this.getElementByXid('vipPrice'+this._sizeI.get());
- var dom5 = this.getElementByXid('weight'+this._sizeI.get());
- $(dom1).remove();
- $(dom2).remove();
- $(dom3).remove();
- $(dom4).remove();
- $(dom5).remove();
- this._sizeI.set(this._sizeI.get()-1);
- }
- };
- //添加input起码要判断之前的有没有给上值 _sizeI
- // size oldPrice price vipPrice weight
- Model.prototype.addSizeClick = function(event){
- if(this.comp("size"+this._sizeI.get()).val() === ""
- || this.comp("price"+this._sizeI.get()).val()
- || this.comp("vipPrice"+this._sizeI.get()).val()
- || this.comp("weight"+this._sizeI.get()).val()){
- layer.open({
- content : "请将原有的规格型号、价格、vip价格、重量填写完整再添加新的",
- skin : "msg",
- time : 2
- });
- return;
- }
- this._sizeI.set(this._sizeI.get()+1);
- var parentNode = this.getElementByXid("newSizeAndPriceDiv");
- //先加一个string的
-
- //从这开始加四个floag的
- var option = {
- parentNode : parentNode,
- xid : "level"+this._sizeI.get(),
- dataType : "Float",
- format : "0,000.00",
- autoComplete : false,
- class : 'form-control x-edit input',
- readonly : false,
- disabled : false,
- };
- new input(option);
-
- };
-
- return Model;
- });
- define(function(require){
- var $ = require("jquery");
- var Model = function(){
- this.callParent();
- };
- Model.prototype.subSizeClick = function(event){
- };
- return Model;
- });
复制代码
|
|