Kaynağa Gözat

新增门店

xiaohaizhao 1 yıl önce
ebeveyn
işleme
f4399a4b9c
5 değiştirilmiş dosya ile 156 ekleme ve 45 silme
  1. 28 4
      components/my_form.vue
  2. 2 0
      pages.json
  3. 1 2
      select/place/index.vue
  4. 16 0
      store/center/detail.vue
  5. 109 39
      store/insert/store.vue

+ 28 - 4
components/my_form.vue

@@ -140,9 +140,12 @@
                                 src="https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404241713944430197B47af9b2f.png"
                                 mode="widthFix" />
                         </view>
-                        <My_upload v-if="item.allowUpload" :showLoading="false" :accept="item.accept"
-                            @uploadCallback="uploadCallback($event, index)" @onLoading="onUploadLoading($event, index)">
-                            <view class="upload-box" hover-class="navigator-hover">
+                        <My_upload v-if="item.allowUpload" :showLoading="false" :maxCount="item.maxCount || 99"
+                            :accept="item.accept" @uploadCallback="uploadCallback($event, index)"
+                            @onLoading="onUploadLoading($event, index)">
+                            <view class="upload-box"
+                                v-if="item.maxCount ? item.value.length != item.maxCount : item.value.length != 99"
+                                hover-class="navigator-hover">
                                 <u-loading-icon v-if="item.loading" />
                                 <text v-else class="iconfont icon-xiazai" />
                                 <text style="margin-left: 5px;">上传</text>
@@ -202,7 +205,7 @@
                             {{ item.label }}:
                         </view>
                         <view class="content-box">
-                            <view class="value" v-if="item.value.length">
+                            <view class="value" v-if="item.showValue.length">
                                 {{ item.showValue.join(",") }}
                             </view>
                             <view v-else class="placeholder" hover-class="none">
@@ -396,6 +399,8 @@ export default {
                 } else if (v.type == 'text') {
                     res = v.value == "";
                     if (v.errText) res = true;
+                } else if (v.type == 'route') {
+                    res = v.showValue.length == 0;
                 } else {
                     res = v.value == "";
                 }
@@ -525,6 +530,25 @@ export default {
                         } else {
                             res[v.key] = v.value;
                         }
+                    } else if (v.type == 'route') {
+                        if (v.isRadio) {
+                            const routeValue = typeof v.value.length == 'number' ? v.value.length ? v.value[0] : '' : v.value || {}
+                            if (v.keys) {
+                                v.keys.forEach(e => {
+                                    res[e] = routeValue ? routeValue[e] || '' : ''
+                                })
+                            } else {
+                                res[v.key] = {
+                                    name: v.showValue[0] || '',
+                                    value: routeValue
+                                };
+                            }
+                        } else {
+                            res[v.key] = {
+                                name: v.showValue || [],
+                                value: v.value || []
+                            };;
+                        }
                     } else {
                         try {
                             res[v.key] = v.value.trim();

+ 2 - 0
pages.json

@@ -74,6 +74,8 @@
 			"path": "storeQRCode/index"
 		}, {
 			"path": "insert/store"
+		}, {
+			"path": "center/detail"
 		}]
 	}, {
 		"root": "cloud",

+ 1 - 2
select/place/index.vue

@@ -131,7 +131,6 @@ export default {
                 name: detail.value,
                 specify: detail.code.map(v => "156" + v),
             }
-            console.log(this.area)
             if (this.keyWord) this.onSearch(this.keyWord)
         },
         unique(arr, key) {
@@ -192,7 +191,7 @@ export default {
             }
         },
         submit() {
-            console.log('提交', this.choose)
+            this.$Http.routeSelected(this.choose)
         }
     },
 }

+ 16 - 0
store/center/detail.vue

@@ -0,0 +1,16 @@
+<template>
+    <view>
+        门店详情
+    </view>
+</template>
+
+<script>
+export default {
+    onLoad(options) {
+        console.log(options)
+    }
+
+}
+</script>
+
+<style></style>

+ 109 - 39
store/insert/store.vue

@@ -1,6 +1,17 @@
 <template>
     <view>
-        <my_form ref="form" :form="form" @isUncomplete="isUncomplete" requiredFieldOnly @interrupt="interrupt" />
+        <my_form ref="form" :form="form" @onUploading="onUploading" @isUncomplete="isUncomplete" requiredFieldOnly
+            @interrupt="interrupt" />
+        <view style="height: 70px;" />
+        <view class="footer">
+            <view class="add" @click="uncomplete || loading ? '' : submit()" :class="uncomplete ? 'forbidden' : ''"
+                hover-class=" navigator-hover">
+                <u-loading-icon v-if="loading" />
+                <block v-else>
+                    提交
+                </block>
+            </view>
+        </view>
     </view>
 </template>
 
@@ -9,12 +20,14 @@ export default {
     data() {
         return {
             sa_storeid: 0,
-            form: []
+            form: [],
+            uncomplete: true,
+            loading: false,
         }
     },
     async onLoad() {
         uni.setNavigationBarTitle({
-            title: '新增人员'
+            title: '新增门店'
         });
         this.form = [{
             key: "storename",
@@ -90,14 +103,38 @@ export default {
             type: "route",
             path: "/select/place/index",
             label: "门店地址",
+            keys: ["latitude", "longitude", "province", "city", "county", "address"],
+            isRadio: true,
+            showValue: [],
             isMust: true,//是否必填
             value: {},
+        }, {
+            key: "attachmentids",
+            type: "upload",
+            label: "门店照片",
+            accept: "image",
+            placeholder: "仅单张",
+            ownertable: "temporary",
+            ownerid: 999,
+            usetype: 'default',
+            allowUpload: true,
+            allowDelete: true,
+            maxCount: 1,
+            value: []
         }];
     },
     methods: {
         isUncomplete(uncomplete) {
             this.uncomplete = uncomplete;
         },
+        onUploading(e) {
+            if (e) {
+                this.copyUncomplete = this.uncomplete;
+                this.uncomplete = true;
+            } else {
+                this.uncomplete = this.copyUncomplete;
+            }
+        },
         interrupt(item, selected, index) {
             console.log(item)
             console.log(selected)
@@ -109,6 +146,11 @@ export default {
                     this.$refs.form.setItem(index, item)
                     this.$refs.form.setValue(index + 1, selected.phonenumber, true)
                     break;
+                case "selectMap":
+                    item.showValue = [selected.name];
+                    item.value = selected;
+                    this.$refs.form.setItem(index, item, true)
+                    break;
             }
 
         },
@@ -116,49 +158,49 @@ export default {
             this.loading = true;
             let that = this;
             this.$refs.form.submit().then(data => {
+                data.leader_hrid = data.leader_hrid.value;
                 this.$Http.basic({
                     "id": 20240410095302,
                     "content": {
                         "sa_storeid": this.sa_storeid,
                         ...data
                     }
-                }).then(res => {
-                    this.loading = false;
-                    console.log("加入团队", res)
+                }).then(async res => {
+                    console.log("创建门店", res)
                     if (this.cutoff(res.msg)) return;
-                    this.loading = true;
-                    if (this.attachmentids.length) {
-                        this.uploadCallback(this.attachmentids, "sys_users", this.userid).then(s => {
-                            if (s) getUserMsg()
-                        });
-                        if (this.headportraits.length) this.$Http.basic({
-                            "classname": "system.attachment.Attachment",
-                            "method": "deleteFileLink",
-                            "content": {
-                                linksids: this.headportraits.map(v => v.linksid)
+                    if (data.files.temporarys.length) await this.$Http.basic({
+                        "classname": "system.attachment.Attachment",
+                        "method": "createFileLink",
+                        "content": {
+                            ownertable: 'sa_store',
+                            ownerid: res.data.sa_storeid,
+                            usetype: 'default',
+                            attachmentids: data.files.temporarys
+                        }
+                    })
+                    if (data.files.linksids.length) await this.$Http.basic({
+                        "classname": "system.attachment.Attachment",
+                        "method": "deleteFileLink",
+                        "content": {
+                            linksids: data.files.linksids
+                        }
+                    })
+                    this.loading = false;
+                    uni.showModal({
+                        title: '创建成功',
+                        content: '门店新增成功!是否立即前往',
+                        cancelText: '返回',
+                        confirmText: '立即前往',
+                        success: ({ confirm }) => {
+                            if (confirm) {
+                                uni.redirectTo({
+                                    url: '/store/center/detail?id=' + res.data.sa_storeid,
+                                })
+                            } else {
+                                uni.navigateBack();
                             }
-                        })
-
-                    } else {
-                        getUserMsg()
-                    }
-                    function getUserMsg() {
-                        that.$Http.wechatLogin().then(token => {
-                            that.loading = false;
-                            uni.showModal({
-                                title: '提示',
-                                content: '成功加入团队',
-                                showCancel: false,
-                                confirmText: '确定',
-                                confirmColor: '#C40C24',
-                                success: ({ confirm }) => {
-                                    if (confirm) uni.redirectTo({
-                                        url: '/pages/index/index',
-                                    })
-                                }
-                            });
-                        })
-                    }
+                        },
+                    })
                 })
             })
         },
@@ -183,4 +225,32 @@ export default {
 }
 </script>
 
-<style></style>
+<style lang="scss" scoped>
+.footer {
+    position: fixed;
+    bottom: 0;
+    width: 100vw;
+    height: 65px;
+    background: #FFFFFF;
+    box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
+    box-sizing: border-box;
+    padding: 5px 10px;
+
+    .add {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 100%;
+        height: 45px;
+        background: #C30D23;
+        border-radius: 5px;
+        font-family: PingFang SC, PingFang SC;
+        font-size: 14px;
+        color: #FFFFFF;
+    }
+
+    .forbidden {
+        opacity: .6;
+    }
+}
+</style>