Browse Source

一些功能

Kirin 4 years ago
parent
commit
377dcdcfa5
1 changed files with 84 additions and 102 deletions
  1. 84 102
      app/admin/view/system/system_store/add.php

+ 84 - 102
app/admin/view/system/system_store/add.php

@@ -24,8 +24,7 @@
                                 <Row>
                                     <i-Col span="13">
                                         <span>门店名称:</span>
-                                        <i-Input placeholder="门店名称" v-model="form.name" style="width: 80%"
-                                                 type="text"></i-Input>
+                                        <i-Input placeholder="门店名称" v-model="form.name" style="width: 80%" type="text"></i-Input>
                                     </i-Col>
                                 </Row>
                             </Form-Item>
@@ -33,8 +32,7 @@
                                 <Row>
                                     <i-Col span="13">
                                         <span>门店简介:</span>
-                                        <i-Input placeholder="门店简介" v-model="form.introduction" style="width: 80%"
-                                                 type="text"></i-Input>
+                                        <i-Input placeholder="门店简介" v-model="form.introduction" style="width: 80%" type="text"></i-Input>
                                     </i-Col>
                                 </Row>
                             </Form-Item>
@@ -42,8 +40,7 @@
                                 <Row>
                                     <i-Col span="13">
                                         <span>门店店长:</span>
-                                        <i-Input placeholder="门店店长" v-model="form.leader" style="width: 80%"
-                                                 type="text"></i-Input>
+                                        <i-Input placeholder="门店店长" v-model="form.leader" style="width: 80%" type="text"></i-Input>
                                     </i-Col>
                                 </Row>
                             </Form-Item>
@@ -51,8 +48,7 @@
                                 <Row>
                                     <i-Col span="13">
                                         <span>门店手机号:</span>
-                                        <i-Input placeholder="门店手机号" v-model="form.phone" style="width: 80%"
-                                                 type="text"></i-Input>
+                                        <i-Input placeholder="门店手机号" v-model="form.phone" style="width: 80%" type="text"></i-Input>
                                     </i-Col>
                                 </Row>
                             </Form-Item>
@@ -60,9 +56,7 @@
                                 <Row>
                                     <i-Col span="13">
                                         <span>门店地址:</span>
-                                        <Cascader :data="addresData" :value.sync="form.address"
-                                                  @on-change="handleChange"
-                                                  style="width: 80%;display: inline-block;"></Cascader>
+                                        <Cascader :data="addresData" :value.sync="form.address" @on-change="handleChange" style="width: 80%;display: inline-block;"></Cascader>
                                     </i-Col>
                                 </Row>
                             </Form-Item>
@@ -70,25 +64,23 @@
                                 <Row>
                                     <i-Col span="13">
                                         <span>详细地址:</span>
-                                        <i-Input placeholder="详细地址" v-model="form.detailed_address" style="width: 80%"
-                                                 type="text"></i-Input>
+                                        <i-Input placeholder="详细地址" v-model="form.detailed_address" style="width: 80%" type="text"></i-Input>
                                     </i-Col>
                                 </Row>
                             </Form-Item>
-                            <!--                            <Form-Item>-->
-                            <!--                                <Row>-->
-                            <!--                                    <i-Col span="13">-->
-                            <!--                                        <span>核销时效:</span>-->
-                            <!--                                        <Date-picker type="daterange" @on-change="changeValidTime" placeholder="选择日期" :value="form.valid_time"></Date-picker>-->
-                            <!--                                    </i-Col>-->
-                            <!--                                </Row>-->
-                            <!--                            </Form-Item>-->
+<!--                            <Form-Item>-->
+<!--                                <Row>-->
+<!--                                    <i-Col span="13">-->
+<!--                                        <span>核销时效:</span>-->
+<!--                                        <Date-picker type="daterange" @on-change="changeValidTime" placeholder="选择日期" :value="form.valid_time"></Date-picker>-->
+<!--                                    </i-Col>-->
+<!--                                </Row>-->
+<!--                            </Form-Item>-->
                             <Form-Item>
                                 <Row>
                                     <i-Col span="13">
                                         <span>营业时间:</span>
-                                        <Time-picker type="timerange" @on-change="changeDayTime" placement="bottom-end"
-                                                     :value="form.day_time" placeholder="选择时间"></Time-picker>
+                                        <Time-picker type="timerange" @on-change="changeDayTime" placement="bottom-end" :value="form.day_time" placeholder="选择时间"></Time-picker>
                                     </i-Col>
                                 </Row>
                             </Form-Item>
@@ -105,9 +97,7 @@
                                                 </div>
                                             </template>
                                         </div>
-                                        <div class="ivu-upload" style="display: inline-block; width: 58px;"
-                                             @click="openWindows('选择图片','{:Url('widget.images/index',['fodder'=>'image'])}',{w:900,h:550})"
-                                             v-if="!form.image">
+                                        <div class="ivu-upload" style="display: inline-block; width: 58px;" @click="openWindows('选择图片','{:Url('widget.images/index',['fodder'=>'image'])}',{w:900,h:550})" v-if="!form.image">
                                             <div class="ivu-upload ivu-upload-drag">
                                                 <div style="width: 58px; height: 58px; line-height: 58px;">
                                                     <i class="ivu-icon ivu-icon-camera" style="font-size: 20px;"></i>
@@ -125,11 +115,8 @@
                                     <i-Col span="13">
                                         <span style="float: left">经纬度:</span>
                                         <Tooltip content="请点击查找位置进行选择位置">
-                                            <i-Input placeholder="经纬度" v-model="form.latlng" :readonly="true"
-                                                     style="width: 80%">
-                                                <span slot="append"
-                                                      @click="openWindows('查找位置','{:Url('select_address')}',{w:400,h:700})"
-                                                      style="cursor:pointer">查找位置</span>
+                                            <i-Input placeholder="经纬度" v-model="form.latlng" :readonly="true" style="width: 80%" >
+                                                <span slot="append" @click="openWindows('查找位置','{:Url('select_address')}',{w:400,h:700})" style="cursor:pointer">查找位置</span>
                                             </i-Input>
                                         </Tooltip>
                                     </i-Col>
@@ -139,8 +126,7 @@
                                 <Row>
                                     <i-Col span="13">
                                         <span>充值分红:</span>
-                                        <i-Input placeholder="充值分红" v-model="form.recharge_award_ratio"
-                                                 style="width: 80%" type="text"></i-Input>
+                                        <i-Input placeholder="充值分红" v-model="form.recharge_award_ratio" style="width: 80%" type="text"></i-Input>
                                     </i-Col>
                                 </Row>
                             </Form-Item>
@@ -160,120 +146,116 @@
 </div>
 <script src="{__PLUG_PATH}city.js"></script>
 <script>
-    var storeData = {
-    :
-    json_encode($store)
-    }
-    ;
-    mpFrame.start(function (Vue) {
-        $.each(city, function (key, item) {
+    var storeData={:json_encode($store)};
+    mpFrame.start(function(Vue) {
+        $.each(city,function (key,item) {
             city[key].value = item.label;
-            if (item.children && item.children.length) {
-                $.each(item.children, function (i, v) {
-                    city[key].children[i].value = v.label;
-                    if (v.children && v.children.length) {
-                        $.each(v.children, function (k, val) {
-                            city[key].children[i].children[k].value = val.label;
+            if(item.children && item.children.length){
+                $.each(item.children,function (i,v) {
+                    city[key].children[i].value=v.label;
+                    if(v.children && v.children.length){
+                        $.each(v.children,function (k,val) {
+                            city[key].children[i].children[k].value=val.label;
                         });
                     }
                 });
             }
         });
         new Vue({
-            data: function () {
+            data:function() {
                 return {
-                    id: storeData.id || 0,
-                    addresData: city,
-                    form: {
-                        name: storeData.name || '',
-                        introduction: storeData.introduction || '',
-                        leader: storeData.leader || '',
-                        phone: storeData.phone || '',
-                        address: storeData.address || [],
-                        image: storeData.image || '',
-                        detailed_address: storeData.detailed_address || '',
-                        latlng: storeData.latlng || '',
-                        valid_time: storeData.valid_time || [],
-                        day_time: storeData.day_time || [],
-                        recharge_award_ratio: storeData.recharge_award_ratio || 0,
+                    id:storeData.id || 0,
+                    addresData:city,
+                    form:{
+                        name:storeData.name || '',
+                        introduction:storeData.introduction || '',
+                        leader:storeData.leader || '',
+                        phone:storeData.phone || '',
+                        address:storeData.address || [],
+                        image:storeData.image || '',
+                        detailed_address:storeData.detailed_address || '',
+                        latlng:storeData.latlng || '',
+                        valid_time:storeData.valid_time || [],
+                        day_time:storeData.day_time || [],
+                        recharge_award_ratio:storeData.recharge_award_ratio || 0,
                     },
-                    visible: false,
+                    visible:false,
                 }
             },
-            methods: {
-                changeDayTime: function (date) {
-                    this.$set(this.form, 'day_time', date);
+            methods:{
+                changeDayTime:function(date){
+                    this.$set(this.form,'day_time',date);
                 },
-                changeValidTime: function (date) {
-                    this.$set(this.form, 'valid_time', date);
+                changeValidTime:function(date){
+                    this.$set(this.form,'valid_time',date);
                 },
-                createFrame: function (title, src, opt) {
+                createFrame:function(title,src,opt){
                     opt === undefined && (opt = {});
                     var h = parent.document.body.clientHeight - 100;
                     return layer.open({
                         type: 2,
-                        title: title,
-                        area: [(opt.w || 700) + 'px', (opt.h || h) + 'px'],
+                        title:title,
+                        area: [(opt.w || 700)+'px', (opt.h || h)+'px'],
                         fixed: false, //不固定
                         maxmin: true,
-                        moveOut: false,//true  可以拖出窗外  false 只能在窗内拖
-                        anim: 5,//出场动画 isOutAnim bool 关闭动画
-                        offset: 'auto',//['100px','100px'],//'auto',//初始位置  ['100px','100px'] t[ 上 左]
-                        shade: 0,//遮罩
-                        resize: true,//是否允许拉伸
+                        moveOut:false,//true  可以拖出窗外  false 只能在窗内拖
+                        anim:5,//出场动画 isOutAnim bool 关闭动画
+                        offset:'auto',//['100px','100px'],//'auto',//初始位置  ['100px','100px'] t[ 上 左]
+                        shade:0,//遮罩
+                        resize:true,//是否允许拉伸
                         content: src,//内容
-                        move: '.layui-layer-title'
+                        move:'.layui-layer-title'
                     });
                 },
-                handleChange: function (value, selectedData) {
+                handleChange:function(value,selectedData){
                     var that = this;
                     that.form.address = [];
-                    $.each(selectedData, function (key, item) {
+                    $.each(selectedData,function (key,item) {
                         that.form.address.push(item.label);
                     });
-                    that.$set(that.form, 'address', that.form.address);
+                    that.$set(that.form,'address',that.form.address);
                 },
-                openWindows: function (title, url, opt) {
-                    return this.createFrame(title, url, opt);
+                openWindows:function(title,url,opt){
+                    return this.createFrame(title,url,opt);
                 },
-                changeIMG: function (name, url) {
-                    this.form[name] = url;
+                changeIMG:function(name,url){
+                    this.form[name]=url;
                 },
-                isPhone: function (test) {
+                isPhone:function(test){
                     var reg = /^1[3456789]\d{9}$/;
                     return reg.test(test);
                 },
-                submit: function () {
+                submit:function () {
                     var that = this;
-                    if (!that.form.name) return $eb.message('error', '请填写门店行名称');
-                    if (!that.form.phone) return $eb.message('error', '请输入手机号码');
-                    if (!that.isPhone(that.form.phone)) return $eb.message('error', '请输入正确的手机号码');
-                    if (!that.form.address) return $eb.message('error', '请选择门店地址');
-                    if (!that.form.detailed_address) return $eb.message('error', '请填写门店详细地址');
-                    if (!that.form.image) return $eb.message('error', '请选择门店logo');
-                    if (!that.form.valid_time) return $eb.message('error', '请选择核销时效');
-                    if (!that.form.day_time) return $eb.message('error', '请选择门店营业时间');
-                    if (!that.form.latlng) return $eb.message('error', '请选择门店经纬度!');
+                    if(!that.form.name) return  $eb.message('error','请填写门店行名称');
+                    if(!that.form.phone) return  $eb.message('error','请输入手机号码');
+                    if(!that.isPhone(that.form.phone)) return  $eb.message('error','请输入正确的手机号码');
+                    if(!that.form.address) return  $eb.message('error','请选择门店地址');
+                    if(!that.form.detailed_address) return  $eb.message('error','请填写门店详细地址');
+                    if(!that.form.image) return  $eb.message('error','请选择门店logo');
+                    if(!that.form.valid_time) return  $eb.message('error','请选择核销时效');
+                    if(!that.form.day_time) return  $eb.message('error','请选择门店营业时间');
+                    if(!that.form.latlng) return  $eb.message('error','请选择门店经纬度!');
                     var index = layer.load(1, {
-                        shade: [0.5, '#fff']
+                        shade: [0.5,'#fff']
                     });
-                    $eb.axios.post('{:Url("save")}' + (that.id ? '?id=' + that.id : ''), that.form).then(function (res) {
+                    $eb.axios.post('{:Url("save")}'+(that.id ? '?id='+that.id : ''),that.form).then(function (res) {
                         layer.close(index);
                         layer.msg(res.data.msg);
-                        if (res.data.data.id) that.id = res.data.data.id;
+                        if(res.data.data.id) that.id=res.data.data.id;
                     }).catch(function (err) {
                         console.log(err);
                         layer.close(index);
                     })
                 },
-                selectAdderss: function (data) {
+                selectAdderss:function (data) {
                     //lat 纬度 lng 经度
-                    this.form.latlng = data.latlng.lat + ',' + data.latlng.lng;
+                    this.form.latlng=data.latlng.lat+','+data.latlng.lng;
                 }
             },
-            mounted: function () {
-                window.changeIMG = this.changeIMG;
-                window.selectAdderss = this.selectAdderss;
+            mounted:function () {
+                window.changeIMG=this.changeIMG;
+                window.selectAdderss=this.selectAdderss;
             }
         }).$mount(document.getElementById('store-attr'))
     })