From eb5b0cd3e99caa28f1be06340fb8d888388a8959 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期三, 03 九月 2025 16:14:26 +0800
Subject: [PATCH] 用户消费金额与总订单数,按标签过滤会员,订单列表会员名称与导出

---
 manager/src/views/order/order/orderList.vue |  333 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 313 insertions(+), 20 deletions(-)

diff --git a/manager/src/views/order/order/orderList.vue b/manager/src/views/order/order/orderList.vue
index 0b8c503..1161466 100644
--- a/manager/src/views/order/order/orderList.vue
+++ b/manager/src/views/order/order/orderList.vue
@@ -18,11 +18,20 @@
             style="width: 160px"
           />
         </Form-item>
-        <Form-item label="浼氬憳鍚嶇О" prop="buyerName">
+<!--        <Form-item label="浼氬憳鍚嶇О" prop="buyerName">-->
+<!--          <Input-->
+<!--            type="text"-->
+<!--            v-model="searchForm.buyerName"-->
+<!--            placeholder="璇疯緭鍏ヤ細鍛樺悕绉�"-->
+<!--            clearable-->
+<!--            style="width: 160px"-->
+<!--          />-->
+<!--        </Form-item>-->
+        <Form-item label="浼氬憳鏄电О" prop="nickName">
           <Input
             type="text"
-            v-model="searchForm.buyerName"
-            placeholder="璇疯緭鍏ヤ細鍛樺悕绉�"
+            v-model="searchForm.nickName"
+            placeholder="璇疯緭鍏ヤ細鍛樻樀绉�"
             clearable
             style="width: 160px"
           />
@@ -95,7 +104,20 @@
         :data="data"
         ref="table"
         sortable="custom"
-      ></Table>
+      >
+        <template slot="sn" slot-scope="{ row }">
+          <div style="width: 100%" @click="detail(row)">
+          <span>{{row.sn}}</span>
+          </div>
+        </template>
+        <template  slot="nickName" slot-scope="{ row }">
+          <div style="width: 100%;height:20px;min-width: 50px" @click="handleNickNameClick(row)">
+            <span >{{row.nickName}}</span>
+          </div>
+
+        </template>
+
+      </Table>
 
       <Row type="flex" justify="end" class="mt_10">
         <Page
@@ -111,17 +133,91 @@
           show-sizer
         ></Page>
       </Row>
+
+      <!-- 淇敼妯℃�佹 -->
+      <Modal v-model="descFlag" width="500">
+
+        <!-- 鑷畾涔夋爣棰樻彃妲� -->
+        <div slot="header" :style="{ color: titleColor, fontSize: '16px', fontWeight: 'bold' }">
+          {{ descTitle }}
+        </div>
+        <Form ref="form" :model="form" :rules="ruleValidate" :label-width="80">
+
+          <Input v-model="form.id" v-show="false" />
+
+          <FormItem label="澶村儚">
+            <img :src="form.face || defaultPic" class="face" />
+            <Button type="text" class="upload" @click="() => {
+            this.picModelFlag = true;
+            this.$refs.ossManage.selectImage = true;
+          }">淇敼</Button>
+            <input type="file" style="display: none" id="file" />
+          </FormItem>
+          <FormItem label="鐢ㄦ埛鍚�" prop="name">
+            <Input v-model="form.username" style="width: 200px" disabled />
+          </FormItem>
+          <FormItem label="鐢ㄦ埛鏄电О" prop="name">
+            <Input v-model="form.nickName" style="width: 200px" />
+          </FormItem>
+          <FormItem label="鏍囩" prop="tags">
+            <Select v-model="selectTagIds" multiple filterable :loading="selectLoading" style="width:200px;">
+              <Option v-for="item in options" :key="item.id" :label="item.tagName" :value="item.id"></Option>
+            </Select>
+          </FormItem>
+          <FormItem label="鎬у埆" prop="sex">
+            <RadioGroup type="button" button-style="solid" v-model="form.sex">
+              <Radio :label="1">
+                <span>鐢�</span>
+              </Radio>
+              <Radio :label="0">
+                <span>濂�</span>
+              </Radio>
+            </RadioGroup>
+          </FormItem>
+          <!--        <FormItem label="淇敼瀵嗙爜" prop="password">-->
+          <!--          <Input type="password" style="width: 220px" password v-model="form.newPassword" />-->
+          <!--        </FormItem>-->
+          <FormItem label="鐢熸棩" prop="birthday">
+            <DatePicker type="date" format="yyyy-MM-dd" v-model="form.birthday" style="width: 220px"></DatePicker>
+          </FormItem>
+          <FormItem label="鎵�鍦ㄥ湴" prop="mail">
+            {{ form.region || '鏆傛棤鍦板潃' }}
+
+
+            <Button style="margin-left: 10px;" @click="$refs.map.open()">閫夋嫨</Button>
+
+          </FormItem>
+
+        </Form>
+        <div slot="footer">
+          <Button @click="descFlag = false">鍙栨秷</Button>
+          <Button type="primary" @click="handleSubmitModal" :disabled="submitDisabled">
+            纭畾
+          </Button>
+        </div>
+      </Modal>
+      <Modal width="1200px" v-model="picModelFlag">
+        <ossManage @callback="callbackSelected" :isComponent="true" :initialize="picModelFlag" ref="ossManage" />
+      </Modal>
+
+      <multipleMap ref="map" @callback="selectedRegion" />
     </Card>
   </div>
 </template>
 
 <script>
+import multipleMap from "@/components/map/multiple-map";
+import ossManage from "@/views/sys/oss-manage/ossManage";
 import * as API_Order from "@/api/order";
 import JsonExcel from "vue-json-excel";
+import * as API_Member from "@/api/member.js";
+import { getTags } from "@/api/tag.js";
 export default {
   name: "orderList",
   components: {
     "download-excel": JsonExcel,
+    ossManage,
+    multipleMap,
   },
   data() {
     return {
@@ -171,6 +267,7 @@
         orderType: "",
         orderSn: "",
         buyerName: "",
+        nickName:"",
         orderStatus: "",
       },
       selectDate: null,
@@ -180,6 +277,7 @@
           key: "sn",
           minWidth: 240,
           tooltip: true,
+          slot: 'sn'
         },
 
         {
@@ -230,9 +328,10 @@
         },
         {
           title: "涔板鍚嶇О",
-          key: "memberName",
+          key: "nickName",
           minWidth: 130,
           tooltip: true,
+          slot:'nickName'
         },
 
         {
@@ -292,26 +391,65 @@
           width: 170,
         },
         {
+          title:"鏀惰揣浜�",
+          key:"consigneeName",
+          width: 170,
+        },
+        {
+          title:"鎵嬫満鍙�",
+          key:"consigneeMobile",
+          width: 170,
+        },
+        {
           title: "鎿嶄綔",
           key: "action",
           align: "center",
-          width: 100,
+          width: 150,
+          fixed:"right",
           render: (h, params) => {
-            return h(
-              "Button",
-              {
-                props: { type: "info", size: "small" },
-                style: { marginRight: "5px" },
-                on: {
-                  click: () => {
-                    this.detail(params.row);
+            const buttons = [];
+
+            // 鏌ョ湅鎸夐挳 - 濮嬬粓鏄剧ず
+            buttons.push(
+              h(
+                "Button",
+                {
+                  props: { type: "info", size: "small" },
+                  style: { marginRight: "5px" },
+                  on: {
+                    click: () => {
+                      this.detail(params.row);
+                    },
                   },
                 },
-              },
-              "鏌ョ湅"
+                "鏌ョ湅"
+              )
             );
+
+            // 鏍规嵁璁㈠崟鐘舵�佷负'PAID'鏃舵樉绀洪澶栨搷浣滄寜閽�
+            if (params.row.orderStatus === 'PAID') {
+              buttons.push(
+                h(
+                  "Button",
+                  {
+                    props: { type: "primary", size: "small" },
+                    style: { marginRight: "5px" },
+                    on: {
+                      click: () => {
+                        this.handlePaidOrder(params.row);
+                      },
+                    },
+                  },
+                  "鏇存柊璁㈠崟鐘舵��"
+                )
+              );
+            }
+
+            return h('div', buttons);
           },
         },
+
+
       ],
       data: [], // 琛ㄥ崟鏁版嵁
       total: 0, // 琛ㄥ崟鏁版嵁鎬绘暟
@@ -327,13 +465,128 @@
         {title: '宸插叧闂�', value: 'CANCELLED'},
 
       ],
-      currentStatus: ''
+      currentStatus: '',
+      descTitle: "", // modal鏍囬
+      descFlag: false, //缂栬緫鏌ョ湅妗�
+      form:{},
+      ruleValidate:{},
+
+      selectTagIds: [],
+      selectTags: [],
+      defaultPic: require('@/assets/default.png'),
+      selectLoading:false,
+      picModelFlag: false, // 閫夋嫨鍥剧墖
+      options: [],
+      titleColor:'#333', // 榛樿鏍囬棰滆壊
+      submitDisabled:false,
     };
   },
   methods: {
+    // 閫変腑鐨勫浘鐗�
+    callbackSelected(val) {
+      console.log(val)
+      this.picModelFlag = false;
+      this.form.face = val.url;
+    },
+     handleNickNameClick(row){
+      this.titleColor = '#333'
+      this.form = {};
+      this.selectTagIds = [];
+      this.selectTags= [];
+      this.descTitle ='';
+      this.descFlag = true;
+      this.getMemberInfo(row.memberId);
+    },
+    /**
+     * 鏌ヨ鏌ョ湅浼氬憳璇︽儏
+     */
+    async getMemberInfo(id) {
+      this.submitDisabled = false;
+      var that = this;
+      await API_Member.getMemberInfoData(id).then((res) => {
+        if (res.result) {
+          debugger
+          that.selectTags = []
+          that.selectTagIds = []
+          res.result.tags.forEach(element => {
+            that.selectTags.push(element.tagName)
+            that.selectTagIds.push(element.tagId)
+          });
+          this.descTitle = res.result.nickName;
+          this.$set(this, "form", res.result);
+        }else{
+          //鏌ヨ鍒扮敤鎴蜂笉瀛樺湪锛屾垨宸插垹闄ゆ儏鍐�
+          this.descTitle = "鐢ㄦ埛宸插垹闄�"
+          this.titleColor ='#ff4d4f';
+          this.submitDisabled = true;
+        }
+        console.log(this.form)
+
+      });
+    },
+    remoteMethod(query) {
+      this.selectLoading = true;
+      var params = {
+        "tagTypeKey": "USER",
+        "pageNumber": 1,
+        "pageSize": 500
+      }
+      getTags(params).then(res => {
+        this.options = res.data;
+        this.selectLoading = false;
+      });
+    },
+    handleSubmitModal(){
+      debugger
+      const { nickName, sex, username, face, newPassword, id, regionId, region } = this.form;
+      let time = new Date(this.form.birthday);
+      let birthday = this.form.birthday === undefined ? '' :
+        time.getFullYear() + "-" + (time.getMonth() + 1) + "-" + time.getDate();
+      let submit = {
+        regionId,
+        region,
+        nickName,
+        username,
+        sex,
+        birthday,
+        face,
+        id
+      };
+
+      submit.tags = this.selectTagIds
+      if (newPassword) {
+        submit.password = this.md5(newPassword);
+      }
+      API_Member.updateMember(submit).then((res) => {
+        if (res.result) {
+          this.$Message.success("淇敼鎴愬姛锛�");
+          this.descFlag = false;
+          this.getDataList();
+        }
+      });
+    },
+
+// 閫変腑鐨勫湴鍧�
+    selectedRegion(val) {
+      if (val.type === 'select') {
+        const paths = val.data.map(item => item.name).join(',')
+        const ids = val.data.map(item => item.id).join(',')
+
+        this.$set(this.form, 'region', paths)
+        this.$set(this.form, 'regionId', ids)
+
+      }
+      else {
+        this.$set(this.form, 'region', val.data.addr)
+        this.$set(this.form, 'regionId', val.data.addrId)
+      }
+    },
+
     // 鍒濆鍖栨暟鎹�
     init() {
       this.getDataList();
+      this.remoteMethod("")
+
     },
     // 鍒嗛〉 鏀瑰彉椤电爜
     changePage(v) {
@@ -369,17 +622,52 @@
           this.total = res.result.total;
         }
       });
-      this.total = this.data.length;
       this.loading = false;
     },
     // 璺宠浆璇︽儏椤甸潰
     detail(v) {
       let sn = v.sn;
-      this.$options.filters.customRouterPush({
+      this.$router.push({
         name: "order-detail",
         query: { sn: sn },
       })
-
+    },
+    // 澶勭悊宸蹭粯娆捐鍗曠殑鎿嶄綔
+    handlePaidOrder(order) {
+      // 杩欓噷鍙互娣诲姞宸蹭粯娆捐鍗曠殑鍏蜂綋鎿嶄綔閫昏緫
+      // 渚嬪锛氭樉绀虹‘璁ゅ璇濇锛屽彂璧峰彂璐ц姹傜瓑
+      this.$Modal.confirm({
+        title: '鏇存柊鐘舵��',
+        content: `纭瀵硅鍗曞彿锛�${order.sn} 杩涜鏇存柊鐘舵搷浣滃悧锛焋,
+        onOk: () => {
+          // 璋冪敤鍙戣揣API
+          this.deliverOrder(order);
+        },
+        onCancel: () => {
+          this.$Message.info('宸插彇娑堟搷浣�');
+        }
+      });
+    },
+    // 鍙戣揣鎿嶄綔
+    deliverOrder(order) {
+      console.log('------------->鑾峰彇璁㈠崟淇℃伅',order);
+      console.log('璁㈠崟sn缂栧彿',order.sn);
+      // 璋冪敤鍙戣揣API
+      API_Order.sendMessage(order.sn).then((res) => {
+        console.log('-------------->',res);
+        if (res.success) {
+          this.$Message.success('鏇存柊鐘舵�佹垚鍔�');
+          // 寤惰繜5绉掑埛鏂板垪琛╩q娑堟伅鏄紓姝ョ殑鏃犳硶瀹炴椂鍚屾闇�瑕佹墽琛屽欢杩熷埛鏂�
+          setTimeout(() => {
+            this.getDataList();
+          }, 5000);
+        } else {
+          this.$Message.error('鏇存柊鐘舵�佸け璐�');
+        }
+      }).catch((error) => {
+        console.error('鏇存柊鐘舵�佸け璐�:', error);
+        this.$Message.error('鏇存柊鐘舵�佸け璐ワ紝璇烽噸璇�');
+      });
     },
     // 瀵煎嚭璁㈠崟
     async exportOrder() {
@@ -451,4 +739,9 @@
     background-color: #ffffff;
   }
 }
+.face {
+  width: 60px;
+  height: 60px;
+  border-radius: 50%; // 鍦嗗舰澶村儚
+}
 </style>

--
Gitblit v1.8.0