Bläddra i källkod

Merge branch 'dev' of http://git.izouma.com/panhui/card-wechat into dev

panhui 4 år sedan
förälder
incheckning
65411f7143

+ 171 - 171
project.private.config.json

@@ -1,174 +1,174 @@
 {
-  "setting": {},
-  "condition": {
-    "plugin": {
-      "list": []
-    },
-    "game": {
-      "list": []
-    },
-    "gamePlugin": {
-      "list": []
-    },
-    "miniprogram": {
-      "list": [
-        {
-          "id": -1,
-          "name": "消息",
-          "pathName": "/pages/news",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "聊天页面",
-          "pathName": "/pages/chat",
-          "query": "toUserId=1&toName=官方店铺",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "我的",
-          "pathName": "/pages/mine",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "我的收藏",
-          "pathName": "/pages/mineFollow",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "个人设置",
-          "pathName": "/pages/setting",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "我的钱包",
-          "pathName": "/pages/wallet",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "授权登陆",
-          "pathName": "/pages/authorized",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "常见问题",
-          "pathName": "/pages/questions",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "选择地址",
-          "pathName": "/pages/chooseAddress",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "订单详情",
-          "pathName": "/pages/orderdetails",
-          "query": "id=779"
-        },
-        {
-          "id": -1,
-          "name": "新增地址",
-          "pathName": "/pages/receiving",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "首页",
-          "pathName": "/pages/Home",
-          "query": "",
-          "scene": null
-        },
-        {
-          "name": "拼箱详情",
-          "pathName": "/pages/details",
-          "query": "id=2570",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "收货地址",
-          "pathName": "/pages/address",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "确认订单",
-          "pathName": "/pages/confirmorder",
-          "query": "caseId=2248&boxIds=2251%2C2257%2C2275%2C2281",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "我买到的",
-          "pathName": "/pages/allorder",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "店铺申请",
-          "pathName": "/pages/store/apply",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "认证审核进度",
-          "pathName": "/pages/store/review",
-          "query": "",
-          "scene": null
-        },
-        {
-          "name": "店铺首页",
-          "pathName": "/pages/store/homePage",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "申请退款",
-          "pathName": "/pages/Apply",
-          "query": "",
-          "scene": null
-        },
-        {
-          "id": -1,
-          "name": "退款详情",
-          "pathName": "/pages/Applydetails",
-          "query": "",
-          "scene": null
-        },
-        {
-          "name": "我卖出的",
-          "pathName": "pages/allsellout",
-          "query": "null",
-          "scene": null
-        },
-        {
-          "name": "新增商品",
-          "pathName": "pages/store/productEdit",
-          "query": "null",
-          "scene": null
+    "setting": {},
+    "condition": {
+        "plugin": {
+            "list": []
+        },
+        "game": {
+            "list": []
+        },
+        "gamePlugin": {
+            "list": []
+        },
+        "miniprogram": {
+            "list": [
+                {
+                    "id": -1,
+                    "name": "消息",
+                    "pathName": "/pages/news",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "聊天页面",
+                    "pathName": "/pages/chat",
+                    "query": "toUserId=1&toName=官方店铺",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "我的",
+                    "pathName": "/pages/mine",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "我的收藏",
+                    "pathName": "/pages/mineFollow",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "个人设置",
+                    "pathName": "/pages/setting",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "我的钱包",
+                    "pathName": "/pages/wallet",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "授权登陆",
+                    "pathName": "/pages/authorized",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "常见问题",
+                    "pathName": "/pages/questions",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "选择地址",
+                    "pathName": "/pages/chooseAddress",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "订单详情",
+                    "pathName": "/pages/orderdetails",
+                    "query": "id=779"
+                },
+                {
+                    "id": -1,
+                    "name": "新增地址",
+                    "pathName": "/pages/receiving",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "首页",
+                    "pathName": "/pages/Home",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "name": "拼箱详情",
+                    "pathName": "/pages/details",
+                    "query": "id=2570",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "收货地址",
+                    "pathName": "/pages/address",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "确认订单",
+                    "pathName": "/pages/confirmorder",
+                    "query": "caseId=2248&boxIds=2251%2C2257%2C2275%2C2281",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "我买到的",
+                    "pathName": "/pages/allorder",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "店铺申请",
+                    "pathName": "/pages/store/apply",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "认证审核进度",
+                    "pathName": "/pages/store/review",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "name": "店铺首页",
+                    "pathName": "/pages/store/homePage",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "申请退款",
+                    "pathName": "/pages/Apply",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "id": -1,
+                    "name": "退款详情",
+                    "pathName": "/pages/Applydetails",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "name": "我卖出的",
+                    "pathName": "pages/allsellout",
+                    "query": "null",
+                    "scene": null
+                },
+                {
+                    "name": "新增商品",
+                    "pathName": "pages/store/productEdit",
+                    "query": "null",
+                    "scene": null
+                }
+            ]
         }
-      ]
     }
-  }
-}
+}

+ 1 - 1
src/components/BillInfo.vue

@@ -1,5 +1,5 @@
 <template>
-    <van-cell :class="{ pay: billType === 'pay' }" title="卡片收益" label="09-03 08:56" value="83.00">
+    <van-cell :class="{ pay: billType === 'pay' }" :title="Info.title" :label="Info.settleTime" :value="Info.amount">
         <img
             slot="icon"
             class="cell-icon"

+ 2 - 1
src/components/CardCase.vue

@@ -120,7 +120,7 @@ export default {
     methods: {
         canChoose(info) {
             let status = ['WAIT', 'PROGRESS'];
-            return status.includes(info.caseStatus) && !info.userId;
+            return status.includes(info.caseStatus) && !info.sold;
         },
         init(type) {
             this.nowChoose = [...this.chooseIds];
@@ -140,6 +140,7 @@ export default {
             this.nowChoose = list;
         },
         submit() {
+            // console.log(this.cardList);
             if (this.nowChoose.length === 0) {
                 this.toast('请选择卡牌');
                 return;

+ 0 - 1
src/components/SeriesSelect.vue

@@ -47,7 +47,6 @@ export default {
                         }
                     )
                     .then(res => {
-                        console.log(res);
                         this.columns = res.content;
                     });
             } else {

+ 2 - 1
src/main.js

@@ -59,6 +59,7 @@ export default {
             'pages/store/review',
             'pages/store/homePage',
             'pages/store/productEdit',
+            'pages/store/administration',
             'pages/store/setting'
         ],
         tabBar: {
@@ -107,7 +108,7 @@ export default {
             'van-sticky': '/vant/sticky/index',
             'van-loading': '/vant/loading/index',
             'van-action-sheet': '/vant/action-sheet/index',
-            'van-picker': '/vant/picker/index',
+            'van-datetime-picker': '/vant/datetime-picker/index',
             'van-cell-group': '/vant/cell-group/index',
             'van-cell': '/vant/cell/index',
             'van-field': '/vant/field/index',

+ 1 - 0
src/pages/Apply.vue

@@ -23,6 +23,7 @@
                 @input="message = $event.detail"
                 rows="1"
                 autosize
+                type="textarea"
                 placeholder="选填"
             />
             <div class="field">

+ 2 - 1
src/pages/details.vue

@@ -56,7 +56,6 @@
         <div class="box-details">
             {{ cardCaseInfo.description }}
         </div>
-        <!-- <img class="container-img" src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/wechat/3.jpeg" alt="" /> -->
         <h3>拼箱规则</h3>
         <div class="box-details">
             1.拼箱是一种类似拼团的玩法,用户选号后支付,当箱中的全部号码都被购买完毕,才算拼箱成功。如果在有限时间内拼箱没有成团,系统会把钱退回给买家<br />
@@ -132,12 +131,14 @@ export default {
                 .get('/cardCase/showInfoMA?caseId=' + this.$mp.options.id)
                 .then(res => {
                     this.hideLoading();
+                    console.log(res);
                     this.detailsList = res.groupBoxMap;
                     this.cardCaseInfo = res.cardCaseInfo || {};
                     this.banners = res.cardCaseInfo.image.split(',');
                     return this.$http.get('/store/get/' + res.cardCaseInfo.storeId);
                 })
                 .then(res => {
+                    console.log(res);
                     this.storeInfo = res;
                 })
                 .catch(e => {

+ 1 - 1
src/pages/mine.vue

@@ -56,7 +56,7 @@
             <van-grid-item text="我发布的" @click="navigateTo('/pages/minePublish')">
                 <img class="gird-icon" src="/native/svgs/info_icon_fabu.svg" slot="icon" alt="" />
             </van-grid-item>
-            <van-grid-item text="我卖出的" @click="wait">
+            <van-grid-item text="我卖出的" @click="navigateTo('/pages/allsellout')">
                 <img class="gird-icon" src="/native/svgs/info_icon_maichu.svg" slot="icon" alt="" />
             </van-grid-item>
             <van-grid-item text="我买到的" @click="navigateTo('/pages/allorder')">

+ 0 - 3
src/pages/receiving.vue

@@ -13,7 +13,6 @@
                 :value="form.name"
                 @input="form.name = $event.detail"
                 placeholder="请填写您的姓名"
-                :border="false"
                 label="联系人"
             />
             <van-field
@@ -21,7 +20,6 @@
                 :value="form.phone"
                 @input="form.phone = $event.detail"
                 placeholder="请填写您的手机号码"
-                :border="false"
                 label="手机号"
             />
             <van-field
@@ -30,7 +28,6 @@
                 readonly
                 is-link
                 placeholder="请选择省市区"
-                :border="false"
                 label="地区"
             />
             <van-field

+ 485 - 0
src/pages/store/administration.vue

@@ -0,0 +1,485 @@
+<config>
+{
+    "navigationBarTitleText": "管理商品",
+    "navigationBarBackgroundColor": "#ffffff",
+}
+</config>
+<template>
+    <div class="addorder">
+        <van-cell-group :border="false">
+            <van-field
+                label="卡牌名称"
+                :value="form.name"
+                placeholder="请输入卡牌名称"
+                is-link
+                readonly
+                @click="show = true"
+            >
+            </van-field>
+            <van-field
+                label="卡牌售价"
+                :value="form.price"
+                @input="form.price = $event.detail"
+                placeholder="请输入金额"
+            >
+            </van-field>
+            <van-field
+                label="拼箱结束"
+                is-link
+                :value="form.dates"
+                placeholder="请输入结束日期"
+                @click="newShow = true"
+            >
+            </van-field>
+            <van-field
+                label="拼箱人数"
+                :value="form.num"
+                @input="form.num = $event.detail"
+                placeholder="请输入参加人数"
+            >
+            </van-field>
+            <van-field
+                label="邮费"
+                :value="form.postage"
+                @input="form.postage = $event.detail"
+                placeholder="默认邮费10元"
+            >
+            </van-field>
+        </van-cell-group>
+        <div class="box-con">
+            <div class="label">卡牌细节图</div>
+            <van-uploader :file-list="fileList" :after-read="afterRead" />
+            <div></div>
+            <div class="box">
+                <div class="top">
+                    <span>选择卡包</span>
+                    <div class="right">
+                        <div class="tool-item">
+                            出售中
+                        </div>
+                        <div class="tool-item used">
+                            下架
+                        </div>
+                    </div>
+                </div>
+
+                <div class="content">
+                    <div class="card" v-for="(card, index) in cardList" :key="index">
+                        <div class="card-title">第{{ index + 1 }}组</div>
+                        <div class="card-list">
+                            <div
+                                v-for="(item, itemIndex) in card"
+                                :key="item.id"
+                                class="card-item"
+                                :class="{
+                                    used: !canChoose(item),
+                                    active: nowChoose.includes(item.id)
+                                }"
+                                @click="choose(item.id, !canChoose(item))"
+                            >
+                                {{ itemIndex }}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="label">卡牌详情描述</div>
+            <van-field
+                :value="form.message"
+                @input="message = $event.detail"
+                :border="false"
+                rows="1"
+                autosize
+                type="textarea"
+                placeholder="卡牌详情描述"
+            />
+        </div>
+        <div class="btn-list">
+            <div @click="submit">确认上架</div>
+        </div>
+        <van-action-sheet
+            :show="show"
+            description="卡牌名称"
+            cancel-text="取消"
+            :actions="actions"
+            @click-overlay="cancel"
+            @select="select"
+            @cancel="cancel"
+        >
+        </van-action-sheet>
+
+        <van-popup :show="newShow" position="bottom" @close="onClose">
+            <van-datetime-picker
+                type="datetime"
+                :value="currentDate"
+                @confirm="onConfirm"
+                @cancel="onCancel"
+                :min-date="minDate"
+                :max-date="maxDate"
+            />
+        </van-popup>
+        <slot></slot>
+    </div>
+</template>
+<script>
+export default {
+    name: 'addorder',
+    data() {
+        return {
+            form: {
+                name: '',
+                num: '',
+                postage: 10,
+                price: '',
+                dates: '',
+                message: ''
+            },
+            show: false,
+            newShow: false,
+            cardCaseInfo: {},
+            chooseIds: [],
+            nowChoose: [],
+            closeFlag: false,
+            detailsList: [],
+            cardList: [{ A: 'A' }, { B: 'B' }, { C: 'C' }],
+            actions: [],
+            minDate: new Date(new Date().getFullYear() - 1, 10, 1).getTime(),
+            maxDate: new Date(new Date().getFullYear() + 2, 10, 1).getTime(),
+            currentDate: new Date().getTime()
+        };
+    },
+    computed: {},
+    watch: {
+        show: {
+            handler: function(newVal) {
+                if (newVal) {
+                    this.cardInit();
+                    this.closeFlag = false;
+                }
+            }
+        }
+    },
+    onLoad() {
+        this.cartBox();
+    },
+    methods: {
+        cardInit() {
+            this.showLoading();
+            this.$http
+                .post(
+                    '/series/all',
+                    { query: { del: false }, page: 0, size: 1000 },
+                    {
+                        header: {
+                            'Content-Type': 'application/json'
+                        }
+                    }
+                )
+                .then(res => {
+                    this.hideLoading();
+                    this.actions = res.content;
+                })
+                .catch(e => {
+                    this.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
+        },
+        timeFormat(date, fmt) {
+            var o = {
+                'M+': date.getMonth() + 1, //月份
+                'd+': date.getDate(), //日
+                'h+': date.getHours(), //小时
+                'm+': date.getMinutes(), //分
+                's+': date.getSeconds() //秒
+            };
+            if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
+            for (var k in o)
+                if (new RegExp('(' + k + ')').test(fmt))
+                    fmt = fmt.replace(
+                        RegExp.$1,
+                        RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
+                    );
+            return fmt;
+        },
+        // 时间确认按钮
+        onConfirm(event) {
+            this.currentDate = event.detail;
+            var timeValue = this.timeFormat(new Date(event.detail), 'yyyy-MM-dd hh:mm');
+            this.form.dates = timeValue;
+            this.newShow = false;
+        },
+        // 时间取消按钮
+        onCancel() {
+            this.newShow = false;
+        },
+        // 遮罩层显示与隐藏
+        onClose() {
+            this.newShow = false;
+        },
+        // 卡牌名称取消按钮
+        cancel() {
+            this.show = false;
+        },
+        canChoose(info) {
+            let status = ['WAIT', 'PROGRESS'];
+            return status.includes(info.caseStatus) && !this.sold;
+        },
+        choose(id, used = false) {
+            if (used) {
+                return;
+            }
+            let list = [...this.nowChoose];
+            if (list.includes(id)) {
+                list.splice(list.indexOf(id), 1);
+            } else {
+                list.push(id);
+            }
+            this.nowChoose = list;
+        },
+        select(e) {
+            if (this.closeFlag) {
+                this.form.name = e.detail.name;
+                this.show = false;
+                return;
+            }
+            let data = {
+                seriesId: e.detail.id
+            };
+            this.showLoading();
+            this.$http
+                .post(
+                    'collection/all',
+                    { query: data, page: 0, size: 1000 },
+                    {
+                        header: {
+                            'Content-Type': 'application/json'
+                        }
+                    }
+                )
+                .then(res => {
+                    this.hideLoading();
+                    this.actions = res.content;
+                    this.closeFlag = true;
+                })
+                .catch(e => {
+                    this.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
+        },
+        cartBox() {
+            // this.$http.post('/cardCase/genNew').then(res => {
+            //     console.log(res);
+            // });
+            this.$http.get('cardCase/getCardCase', { id: 2767 }).then(res => {
+                console.log(res);
+                this.form = {
+                    price: res.boxPrice,
+                    dates: res.startTime,
+                    message: res.description,
+                    num: res.boxesCount
+                };
+            });
+        },
+        submit() {
+            if (!this.form.name) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '卡牌名称不能为空'
+                });
+                return;
+            }
+            if (!this.form.price) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '价格不能为空'
+                });
+                return;
+            }
+            if (!this.form.dates) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '结束时间不能为空'
+                });
+                return;
+            }
+            wx.showToast({
+                title: '提交成功'
+            });
+        }
+    }
+};
+</script>
+<style lang="less" scoped>
+/deep/ .van-uploader {
+    margin-top: 20px;
+}
+/deep/ .van-cell {
+    --cell-vertical-padding: 23px;
+    --cell-horizontal-padding: 20px;
+    --field-label-color: #000000;
+    --cell-text-color: #000;
+    .van-field__label,
+    .van-cell__title {
+        font-weight: bold;
+        width: 70px;
+        max-width: 70px !important;
+        min-width: 70px !important;
+        flex-shrink: 0;
+        margin-right: 10px !important;
+    }
+    .van-cell__value {
+        text-align: left;
+    }
+
+    &::after {
+        left: 100px !important;
+    }
+}
+.addorder {
+    padding-bottom: 90px;
+    .box-con {
+        margin: 23px 0 0 20px;
+        .label {
+            font-size: 14px;
+            font-weight: bold;
+            color: #000000;
+            margin-left: -3px;
+            line-height: 24px;
+        }
+        .box {
+            max-height: 70vh;
+            min-height: 50vh;
+            padding-right: 20px;
+            .flex-col();
+            padding-bottom: 6px;
+        }
+
+        .content {
+            flex-grow: 1;
+            overflow: auto;
+            padding: 0 0 12px;
+        }
+
+        .top {
+            .flex();
+            justify-content: space-between;
+            padding: 20px 0;
+            flex-shrink: 0;
+
+            span {
+                font-size: 14px;
+                font-weight: bold;
+                color: #000000;
+                line-height: 24px;
+            }
+
+            .right {
+                .flex();
+                .tool-item {
+                    font-size: 14px;
+                    color: #000000;
+                    line-height: 24px;
+                    .flex();
+                    margin-left: 30px;
+
+                    &::before {
+                        content: '';
+                        flex-shrink: 0;
+                        width: 16px;
+                        height: 16px;
+                        background: #ffffff;
+                        border-radius: 4px;
+                        border: 1px solid #f5f7fa;
+                        margin-right: 4px;
+                    }
+
+                    &.used {
+                        &::before {
+                            background-color: #939599;
+                        }
+                    }
+                }
+            }
+        }
+        .card + .card {
+            margin-top: 12px;
+        }
+
+        .card-title {
+            font-size: 14px;
+            color: #939599;
+            line-height: 24px;
+        }
+        .card {
+            background-color: @bg;
+            padding: 12px 16px;
+            border-radius: 8px;
+            .card-list {
+                .flex();
+                flex-wrap: wrap;
+                .card-item {
+                    width: 42px;
+                    height: 42px;
+                    background: #ffffff;
+                    border-radius: 8px;
+                    font-size: 16px;
+                    font-weight: bold;
+                    text-align: center;
+                    color: #000000;
+                    line-height: 42px;
+                    margin-top: 10px;
+                    &.used {
+                        background-color: #939599;
+                        color: #ffffff;
+                    }
+
+                    &.active {
+                        background-color: @prim;
+                        color: #ffffff;
+                    }
+
+                    &:active {
+                        opacity: 0.8;
+                    }
+
+                    &:nth-child(6n + 1) {
+                        margin-left: 0 !important;
+                    }
+                }
+
+                .card-item + .card-item {
+                    margin-left: 10px;
+                }
+            }
+        }
+    }
+}
+.van-cell {
+    line-height: 40px;
+}
+.btn-list {
+    position: fixed;
+    width: 100%;
+    bottom: 0;
+    background: #ffffff;
+    padding-left: 43px;
+    .bottom();
+    div {
+        width: 290px;
+        height: 48px;
+        background: #ff6c00;
+        border-radius: 12px;
+        line-height: 48px;
+        text-align: center;
+        font-size: 16px;
+        font-weight: 400;
+        color: #ffffff;
+    }
+}
+</style>

+ 399 - 80
src/pages/store/productEdit.vue

@@ -5,149 +5,333 @@
 }
 </config>
 <template>
-    <div class="apply">
+    <div class="addorder">
         <van-cell-group :border="false">
             <van-field
                 label="卡牌名称"
-                :value="name"
+                :value="form.name"
                 placeholder="请输入卡牌名称"
                 is-link
                 readonly
                 @click="show = true"
             >
             </van-field>
-            <van-field label="卡牌销售" :value="price" @input="price = $event.detail" placeholder="请输入金额">
+            <van-field
+                label="卡牌售价"
+                :value="form.price"
+                @input="form.price = $event.detail"
+                placeholder="请输入金额"
+            >
+            </van-field>
+            <van-field
+                label="拼箱结束"
+                is-link
+                :value="form.dates"
+                placeholder="请输入结束日期"
+                @click="newShow = true"
+            >
             </van-field>
-            <van-field label="拼箱结束" :value="dates" placeholder="请输入结束日期"> </van-field>
             <van-field
                 label="拼箱人数"
-                :value="num"
-                @input="num = $event.detail"
-                rows="1"
-                autosize
+                :value="form.num"
+                @input="form.num = $event.detail"
                 placeholder="请输入参加人数"
             >
             </van-field>
             <van-field
                 label="邮费"
-                :value="price"
-                @input="price = $event.detail"
-                rows="1"
-                autosize
+                :value="form.postage"
+                @input="form.postage = $event.detail"
                 placeholder="默认邮费10元"
             >
             </van-field>
-            <van-field label="卡牌细节图" :border="false"> </van-field>
         </van-cell-group>
+        <div class="box-con">
+            <div class="label">卡牌细节图</div>
+            <van-uploader :file-list="fileList" :after-read="afterRead" @delete="deleteImg" />
+            <div></div>
+            <div class="box">
+                <div class="top">
+                    <span>选择卡包</span>
+                    <div class="right">
+                        <div class="tool-item">
+                            出售中
+                        </div>
+                        <div class="tool-item used">
+                            下架
+                        </div>
+                    </div>
+                </div>
 
+                <div class="content">
+                    <div class="card" v-for="(card, index) in cardList" :key="index">
+                        <div class="card-title">第{{ index + 1 }}组</div>
+                        <div class="card-list">
+                            <div
+                                v-for="(item, itemIndex) in card"
+                                :key="item.id"
+                                class="card-item"
+                                :class="{
+                                    used: !canChoose(item),
+                                    active: nowChoose.includes(item.id)
+                                }"
+                                @click="choose(item.id, !canChoose(item))"
+                            >
+                                {{ itemIndex }}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="label">卡牌详情描述</div>
+            <van-field
+                :value="form.message"
+                @input="message = $event.detail"
+                :border="false"
+                rows="1"
+                autosize
+                type="textarea"
+                placeholder="多多介绍您的卡牌信息,更受欢迎哦"
+            />
+        </div>
         <div class="btn-list">
-            <van-button :color="$colors.prim" :disabled="!canSubmit" block @click="submit">确认上架</van-button>
+            <div @click="submit">确认上架</div>
         </div>
-
         <van-action-sheet
             :show="show"
             description="卡牌名称"
             cancel-text="取消"
-            @overlay="overlay = false"
-            @click="cancel"
             :actions="actions"
+            @click-overlay="cancel"
             @select="select"
+            @cancel="cancel"
         >
         </van-action-sheet>
-        <!-- <van-datetime-picker type="year-month" :value="currentDate" :min-date="minDate" @input="onInput" /> -->
+
+        <van-popup :show="newShow" position="bottom" @close="onClose">
+            <van-datetime-picker
+                type="datetime"
+                :value="currentDate"
+                @confirm="onConfirm"
+                @cancel="onCancel"
+                :min-date="minDate"
+                :max-date="maxDate"
+            />
+        </van-popup>
+        <slot></slot>
     </div>
 </template>
 <script>
 export default {
-    name: 'apply',
+    name: 'addorder',
     data() {
         return {
-            name: '',
-            num: '',
-            price: '',
+            form: {
+                name: '',
+                num: '',
+                postage: 10,
+                price: '',
+                dates: '',
+                message: ''
+            },
             show: false,
-            actions: [
-                {
-                    name: '地址/电话等信息填写错误'
-                },
-                {
-                    name: '多拍/错拍/不想要'
-                },
-                {
-                    name: '未按约定时间发货'
-                },
-                {
-                    name: '其他'
-                }
-            ]
-            // currentDate: new Date().getTime(),
-            // minDate: new Date().getTime()
+            newShow: false,
+            cardCaseInfo: {},
+            fileList: [],
+            chooseIds: [],
+            nowChoose: [],
+            closeFlag: false,
+            detailsList: [],
+            cardList: [{ A: 'A' }, { B: 'B' }, { C: 'C' }],
+            actions: [],
+            minDate: new Date(new Date().getFullYear() - 1, 10, 1).getTime(),
+            maxDate: new Date(new Date().getFullYear() + 2, 10, 1).getTime(),
+            currentDate: new Date().getTime()
         };
     },
-    computed: {
-        // canSubmit() {
-        //     if (this.name && this.price) {
-        //         return true;
-        //     } else {
-        //         return false;
-        //     }
-        // }
+    computed: {},
+    watch: {
+        show: {
+            handler: function(newVal) {
+                if (newVal) {
+                    this.cardInit();
+                    this.closeFlag = false;
+                }
+            }
+        }
+    },
+    onLoad() {
+        this.cartBox();
     },
-    created() {},
     methods: {
-        select(action) {
-            this.name = action.detail.name;
+        cardInit() {
+            this.showLoading();
+            this.$http
+                .post(
+                    '/series/all',
+                    { query: { del: false }, page: 0, size: 1000 },
+                    {
+                        header: {
+                            'Content-Type': 'application/json'
+                        }
+                    }
+                )
+                .then(res => {
+                    this.hideLoading();
+                    this.actions = res.content;
+                })
+                .catch(e => {
+                    this.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
+        },
+        timeFormat(date, fmt) {
+            var o = {
+                'M+': date.getMonth() + 1, //月份
+                'd+': date.getDate(), //日
+                'h+': date.getHours(), //小时
+                'm+': date.getMinutes(), //分
+                's+': date.getSeconds() //秒
+            };
+            if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
+            for (var k in o)
+                if (new RegExp('(' + k + ')').test(fmt))
+                    fmt = fmt.replace(
+                        RegExp.$1,
+                        RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
+                    );
+            return fmt;
+        },
+        // 时间确认按钮
+        onConfirm(event) {
+            this.currentDate = event.detail;
+            var timeValue = this.timeFormat(new Date(event.detail), 'yyyy-MM-dd hh:mm');
+            this.form.dates = timeValue;
+            this.newShow = false;
+        },
+        // 时间取消按钮
+        onCancel() {
+            this.newShow = false;
+        },
+        // 遮罩层显示与隐藏
+        onClose() {
+            this.newShow = false;
+        },
+        // 卡牌名称取消按钮
+        cancel() {
             this.show = false;
         },
+        canChoose(info) {
+            let status = ['WAIT', 'PROGRESS'];
+            return status.includes(info.caseStatus) && !this.sold;
+        },
+        choose(id, used = false) {
+            if (used) {
+                return;
+            }
+            let list = [...this.nowChoose];
+            if (list.includes(id)) {
+                list.splice(list.indexOf(id), 1);
+            } else {
+                list.push(id);
+            }
+            this.nowChoose = list;
+        },
+        select(e) {
+            if (this.closeFlag) {
+                this.form.name = e.detail.name;
+                this.show = false;
+                return;
+            }
+            let data = {
+                seriesId: e.detail.id
+            };
+            this.showLoading();
+            this.$http
+                .post(
+                    'collection/all',
+                    { query: data, page: 0, size: 1000 },
+                    {
+                        header: {
+                            'Content-Type': 'application/json'
+                        }
+                    }
+                )
+                .then(res => {
+                    this.hideLoading();
+                    this.actions = res.content;
+                    this.closeFlag = true;
+                })
+                .catch(e => {
+                    this.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
+        },
+        cartBox() {
+            this.$http.post('/cardCase/genNew').then(res => {
+                console.log(res);
+            });
+        },
+        afterRead(file) {
+            this.showLoading();
+            this.$http
+                .uploadFile(file.path)
+                .then(res => {
+                    this.hideLoading();
+                    console.log(res);
+                    let fileList = [];
+                    fileList.push({ ...file, url: res });
+                    this.fileList = fileList;
+                })
+                .catch(e => {
+                    this.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
+        },
+        deleteImg() {
+            this.fileList = [];
+        },
         submit() {
-            if (!this.reason) {
+            if (!this.form.name) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '卡牌名称不能为空'
+                });
+                return;
+            }
+            if (!this.form.price) {
                 wx.showToast({
                     icon: 'none',
-                    title: '退货原因不能为空'
+                    title: '价格不能为空'
                 });
                 return;
             }
-            if (!this.price) {
+            if (!this.form.dates) {
                 wx.showToast({
                     icon: 'none',
-                    title: '退货价格不能为空'
+                    title: '结束时间不能为空'
                 });
                 return;
             }
-            // console.log(this.reason);
-            // console.log(this.price);
-            // console.log(this.message);
             wx.showToast({
                 title: '提交成功'
             });
-        },
-        cancel() {
-            this.show = false;
         }
     }
 };
 </script>
 <style lang="less" scoped>
-.box {
-    margin: 30px 53px;
-    .box-size {
-        width: 154px;
-        font-size: 14px;
-        font-weight: bold;
-        color: #000000;
-        line-height: 20px;
-        margin: 20px 0 15px 0;
-    }
-    .box-butm {
-        .flex();
-        p {
-            font-size: 13px;
-        }
-        span {
-            font-size: 13px;
-            color: red;
-        }
-    }
+/deep/ .van-uploader {
+    margin-top: 20px;
 }
 /deep/ .van-cell {
     --cell-vertical-padding: 23px;
@@ -171,10 +355,145 @@ export default {
         left: 100px !important;
     }
 }
+.addorder {
+    padding-bottom: 90px;
+    .box-con {
+        margin: 23px 0 0 20px;
+        .label {
+            font-size: 14px;
+            font-weight: bold;
+            color: #000000;
+            margin-left: -3px;
+            line-height: 24px;
+        }
+        .box {
+            max-height: 70vh;
+            min-height: 50vh;
+            padding-right: 20px;
+            .flex-col();
+            padding-bottom: 6px;
+        }
+
+        .content {
+            flex-grow: 1;
+            overflow: auto;
+            padding: 0 0 12px;
+        }
+
+        .top {
+            .flex();
+            justify-content: space-between;
+            padding: 20px 0;
+            flex-shrink: 0;
+
+            span {
+                font-size: 14px;
+                font-weight: bold;
+                color: #000000;
+                line-height: 24px;
+            }
+
+            .right {
+                .flex();
+                .tool-item {
+                    font-size: 14px;
+                    color: #000000;
+                    line-height: 24px;
+                    .flex();
+                    margin-left: 30px;
+
+                    &::before {
+                        content: '';
+                        flex-shrink: 0;
+                        width: 16px;
+                        height: 16px;
+                        background: #ffffff;
+                        border-radius: 4px;
+                        border: 1px solid #f5f7fa;
+                        margin-right: 4px;
+                    }
+
+                    &.used {
+                        &::before {
+                            background-color: #939599;
+                        }
+                    }
+                }
+            }
+        }
+        .card + .card {
+            margin-top: 12px;
+        }
+
+        .card-title {
+            font-size: 14px;
+            color: #939599;
+            line-height: 24px;
+        }
+        .card {
+            background-color: @bg;
+            padding: 12px 16px;
+            border-radius: 8px;
+            .card-list {
+                .flex();
+                flex-wrap: wrap;
+                .card-item {
+                    width: 42px;
+                    height: 42px;
+                    background: #ffffff;
+                    border-radius: 8px;
+                    font-size: 16px;
+                    font-weight: bold;
+                    text-align: center;
+                    color: #000000;
+                    line-height: 42px;
+                    margin-top: 10px;
+                    &.used {
+                        background-color: #939599;
+                        color: #ffffff;
+                    }
+
+                    &.active {
+                        background-color: @prim;
+                        color: #ffffff;
+                    }
+
+                    &:active {
+                        opacity: 0.8;
+                    }
+
+                    &:nth-child(6n + 1) {
+                        margin-left: 0 !important;
+                    }
+                }
+
+                .card-item + .card-item {
+                    margin-left: 10px;
+                }
+            }
+        }
+    }
+}
 .van-cell {
     line-height: 40px;
 }
 .btn-list {
-    margin: 40px;
+    position: fixed;
+    width: 100%;
+    bottom: 0;
+    background: #ffffff;
+    padding-left: 43px;
+    .bottom();
+    div {
+        width: 290px;
+        height: 48px;
+        background: #ff6c00;
+        border-radius: 12px;
+        line-height: 48px;
+        text-align: center;
+        font-size: 16px;
+        font-weight: 400;
+        color: #ffffff;
+    }
 }
 </style>

+ 89 - 40
src/pages/wallet.vue

@@ -27,15 +27,11 @@
         <van-sticky :offset-top="0">
             <div class="time-box">
                 <van-dropdown-menu>
-                    <van-dropdown-item :value="time" :options="option1" />
+                    <van-dropdown-item @change="record" :value="time" :options="option1" />
                 </van-dropdown-menu>
                 <div class="flex1"></div>
-                <span class="text">
-                    收入 0
-                </span>
-                <span class="text">
-                    提现 0
-                </span>
+                <span class="text"> 收入 ¥{{ count }} </span>
+                <span class="text"> 提现 ¥{{ TXCount }} </span>
             </div>
         </van-sticky>
 
@@ -47,9 +43,11 @@
             >
             </van-empty>
 
-            <template v-else>
-                <bill-info></bill-info>
-                <bill-info billType="pay"></bill-info>
+            <template>
+                <div v-for="(item, index) in recordList" :key="index">
+                    <bill-info :Info="item"></bill-info>
+                    <bill-info billType="pay" :Info="item"></bill-info>
+                </div>
             </template>
         </div>
     </div>
@@ -65,32 +63,23 @@ export default {
         return {
             moneyInfo: {},
             time: 0,
-            newDate: {},
             option1: [
-                { text: '2012年1月', value: 0 },
-                { text: '2012年2月', value: 1 },
-                { text: '2012年3月', value: 2 },
-                { text: '2012年4月', value: 3 },
-                { text: '2012年5月', value: 4 },
-                { text: '2012年6月', value: 5 },
-                { text: '2012年7月', value: 6 },
-                { text: '2012年8月', value: 7 },
-                { text: '2012年9月', value: 8 },
-                { text: '2012年10月', value: 9 },
-                { text: '2012年11月', value: 10 },
-                { text: '2012年12月', value: 11 }
+                { text: '2021-05', value: 0 },
+                { text: '2021-06', value: 1 },
+                { text: '2021-07', value: 2 },
+                { text: '2021-08', value: 3 },
+                { text: '2021-09', value: 4 },
+                { text: '2021-10', value: 5 },
+                { text: '2021-11', value: 6 },
+                { text: '2021-12', value: 7 }
             ],
-            empty: true
+            empty: false,
+            recordList: {},
+            count: 0,
+            TXCount: 0
         };
     },
-    computed: {
-        dateList() {
-            let info = [...this.newDate].find(item => {
-                return item.text;
-            });
-            return info;
-        }
-    },
+    computed: {},
     methods: {
         loginMethods() {
             this.$http.get('/memberInfo/findByUser').then(res => {
@@ -102,15 +91,75 @@ export default {
                 query: {}
             });
         },
-        Withdrawal() {}
+        Withdrawal() {
+            this.showLoading();
+            let userId = this.$store.state.userInfo.id;
+            this.$http
+                .post('/memberInfo/newWithDraw', { userId, money: this.moneyInfo.money })
+                .then(res => {
+                    this.hideLoading();
+                    console.log(res);
+                    wx.showToast({
+                        title: '提现成功'
+                    });
+                })
+                .catch(e => {
+                    this.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
+        },
+        record(e) {
+            this.time = e.detail;
+            let targetData = this.option1.find(item => {
+                return item.value == this.time;
+            });
+            this.initApi(targetData.text);
+        },
+        initApi(params) {
+            this.showLoading();
+            this.$http
+                .get('/transactionRecord/showMyTransactionRecords', { yearMonth: params })
+                .then(res => {
+                    this.hideLoading();
+                    this.recordList = res;
+                    let countArr = [],
+                        TXCount = [];
+                    if (res.length === 0) {
+                        this.empty = true;
+                    } else {
+                        this.empty = false;
+                    }
+                    countArr = this.recordList.filter(item => {
+                        return item.type == 'SOLD';
+                    });
+                    TXCount = this.recordList.filter(item => {
+                        return item.type == 'WITHDRAW';
+                    });
+                    if (countArr.length > 0) {
+                        this.count = countArr.reduce((total, item) => {
+                            return total + item.amount;
+                        }, 0);
+                    }
+                    if (TXCount.length > 0) {
+                        this.TXCount = TXCount.reduce((total, item) => {
+                            return total + item.amount;
+                        }, 0);
+                    }
+                })
+                .catch(e => {
+                    this.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
+        }
     },
-    onShow() {
-        this.newDate = this.option1;
-        let Aike = this.dateList.text.replace(/%E5%B9%B4/g, '年');
-        console.log(Aike);
-        // this.$http.get('/transactionRecord/showMyTransactionRecords', { yearMonth: Aike }).then(res => {
-        //     console.log(res);
-        // });
+    onLoad() {
+        this.initApi(this.option1[0].text);
     }
 };
 </script>