panhui 6 ani în urmă
părinte
comite
6428fd44f5

+ 32 - 3
project.config.json

@@ -33,7 +33,7 @@
 			"list": []
 		},
 		"miniprogram": {
-			"current": 5,
+			"current": 4,
 			"list": [
 				{
 					"id": 0,
@@ -60,20 +60,49 @@
 					"id": 3,
 					"name": "在线选片",
 					"pathName": "pages/selectPhotos/selectPhotos",
-					"query": "",
+					"query": "orderId=69",
 					"scene": null
 				},
 				{
 					"id": 4,
 					"name": "在线审片",
 					"pathName": "pages/examinePhotos/examinePhotos",
-					"query": "",
+					"query": "orderId=74&imageRepairId=5",
 					"scene": null
 				},
 				{
 					"id": -1,
 					"name": "私人定制",
 					"pathName": "pages/customize/customize",
+					"query": "",
+					"scene": null
+				},
+				{
+					"id": -1,
+					"name": "我的优惠券",
+					"pathName": "pages/myCoupon/myCoupon",
+					"query": "",
+					"scene": null
+				},
+				{
+					"id": 7,
+					"name": "订单详情",
+					"pathName": "pages/orderDetail/orderDetail",
+					"query": "orderId=74",
+					"scene": null
+				},
+				{
+					"id": -1,
+					"name": "登录",
+					"pathName": "pages/login/login",
+					"query": "",
+					"scene": null
+				},
+				{
+					"id": 9,
+					"name": "提交订单",
+					"pathName": "pages/submit/submit",
+					"query": "submitPage=shoppingCart&chooseList=27",
 					"scene": null
 				}
 			]

+ 11 - 0
src/Constants.js

@@ -18,4 +18,15 @@ exports.OrderStatus = {
     ACCESSOVER: 9, //取件完成
     FINISH: 10, //成功
     CANCEL: 11, //取消
+};
+
+
+exports.OrderAlbumStatus = {
+    WAITUPLOAD: 0,
+    WAITSELECT: 1,
+    SELECTOVER: 2,
+    WAITACCEPT: 3,
+    REWORK: 4,
+    REWORKACCEPT: 5,
+    FINISH: 6,
 };

+ 3 - 1
src/app.json

@@ -28,7 +28,9 @@
         "pages/addAddress/addAddress",
         "pages/myCoupon/myCoupon",
         "pages/myPoint/myPoint",
-        "pages/examinePhotos/examinePhotos"
+        "pages/examinePhotos/examinePhotos",
+        "pages/couponList/couponList",
+        "pages/useCoupon/useCoupon"
     ],
     "window": {
         "backgroundTextStyle": "light",

+ 49 - 8
src/components/Coupon.vue

@@ -1,23 +1,55 @@
 <template>
-    <div class='coupon'>
-        <div class="money">300</div>
+    <div class="coupon" :class="{has:info.userCount>0}">
+        <div class="money">{{info.discountMoney}}</div>
 
         <div class="explain">
-            <div class="title">立减券</div>
-            <div class="sub">满1000元可用</div>
+            <div class="title">{{info.name}}</div>
+            <div class="sub">满{{info.limitMoney}}元可用</div>
         </div>
 
         <div class="hr"></div>
-
-        <div class="btn">立即领取</div>
+        <div class="btn" v-if="info.userCount>0">已领取</div>
+        <div class="btn" @click="receive" v-else>立即领取</div>
     </div>
 </template>
 <script>
 export default {
-    name: 'coupon',
+    name: "coupon",
+    props: {
+        info: {
+            type: Object,
+            default: () => {
+                return {};
+            }
+        }
+    },
     data() {
         return {};
     },
+    methods: {
+        receive() {
+            this.$http
+                .post(
+                    "/couponDetail/receive",
+                    {
+                        id: this.info.couponDetailList[0].id,
+                        userId: this.$store.state.userInfo.id
+                    },
+                    {},
+                    false
+                )
+                .then(res => {
+                    if (res.success) {
+                        wx.showToast({
+                            title: "领取成功",
+                            icon: "success",
+                            duration: 1500
+                        });
+                        this.$emit("updateCoupon");
+                    }
+                });
+        }
+    }
 };
 </script>
 <style lang='less' scoped>
@@ -32,6 +64,15 @@ export default {
     display: flex;
     align-items: center;
     border-radius: 16rpx;
+
+    &.has {
+        background: rgba(173, 173, 173, 1);
+
+        .btn {
+            background: rgba(203, 203, 203, 1);
+            color: #656565;
+        }
+    }
 }
 
 .money {
@@ -41,7 +82,7 @@ export default {
     line-height: 124rpx;
     margin-left: 34rpx;
     &::before {
-        content: '¥';
+        content: "¥";
         font-size: 32rpx;
         font-weight: normal;
         color: rgba(255, 255, 255, 1);

+ 50 - 8
src/components/HomeCoupon.vue

@@ -1,30 +1,72 @@
 <template>
     <div class="homeCoupon">
-        <navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
+        <navigator
+            url="/pages/couponList/couponList"
+            class="weui-cell weui-cell_access"
+            hover-class="weui-cell_active"
+        >
             <view class="weui-cell__bd">优惠券</view>
             <view class="weui-cell__ft weui-cell__ft_in-access">查看更多</view>
         </navigator>
 
         <div class="couponList">
-            <coupon></coupon>
-            <coupon></coupon>
+            <coupon
+                v-for="(item,index) in couponList"
+                :key="index"
+                :info="item"
+                @updateCoupon="getCoupon"
+            ></coupon>
         </div>
     </div>
 </template>
 <script>
-import coupon from './Coupon'
+import coupon from "./Coupon";
+import { mapState } from "vuex";
 export default {
     data() {
-        return {};
+        return {
+            couponList: []
+        };
+    },
+    computed: {
+        ...mapState(["userInfo"])
+    },
+    watch: {
+        "userInfo.id"() {
+            if (this.userInfo.id) {
+                this.getCoupon();
+            }
+        }
+    },
+    onLoad() {
+        if (this.userInfo.id) {
+            this.getCoupon();
+        }
+    },
+    methods: {
+        getCoupon() {
+            var data = {
+                receiveFlag: "N",
+                userId: this.userInfo.id,
+                onShelf: "Y",
+                openFlag: "Y",
+                checkTime: 1
+            };
+
+            this.$http.get("/couponInfo/all", data).then(res => {
+                if (res.success) {
+                    this.couponList = res.data;
+                }
+            });
+        }
     },
     components: {
         coupon
-    },
+    }
 };
 </script>
 <style lang='less' scoped>
-
-.couponList{
+.couponList {
     overflow: hidden;
 }
 </style>

+ 12 - 0
src/components/Message.vue

@@ -16,6 +16,10 @@ export default {
             type: Boolean,
             default: false,
         },
+        message:{
+            type:String,
+            default:''
+        }
     },
     data() {
         return {
@@ -23,6 +27,14 @@ export default {
             text:''
         };
     },
+    watch:{
+        message(){
+            this.text=this.message;
+        }
+    },
+    onLoad(){
+    this.text=this.message;
+    },
     computed: {
         ...mapState(['userInfo']),
     },

+ 57 - 13
src/components/MyCoupon.vue

@@ -1,33 +1,71 @@
 <template>
-    <div class='coupon' :class="{notUse:stauts==1}">
-        <div class="couponTop">
-            <div class="money">300</div>
+    <div class="coupon" :class="{notUse:stauts==1}">
+        <div class="couponTop"  @click="goUse">
+            <div class="money">{{info.discountMoney}}</div>
 
             <div class="explain">
-                <div class="title">立减券</div>
-                <div class="sub">满1000元可用</div>
+                <div class="title">{{info.name}}</div>
+                <div class="sub">满{{info.limitMoney}}元可用</div>
             </div>
 
-            <div class="btn">{{stauts==1?'已过期':'立即使用'}}</div>
+            <div class="btn" v-if="type=='user'">{{stauts==1?'已过期':'立即使用'}}</div>
+            <img class="chooseImg" v-else-if='isChoose' src="/static/images/gouwuche_icon_xuanzhong.png" alt="">
+             <img class="chooseImg" v-else src="/static/images/gouwuche_icon_weixuanzhong.png" alt="">
         </div>
 
-        <div class="time">
-            过期时间:2019-06-06 23:59
-        </div>
+        <div class="time">过期时间:{{endTime}}</div>
     </div>
 </template>
 <script>
+import { formatTime } from "../time";
 export default {
-    name: 'myCoupon',
+    name: "myCoupon",
     props: {
         stauts: {
             type: Number,
-            default: 0,
+            default: 0
+        },
+        info: {
+            type: Object,
+            default: () => {
+                return {};
+            }
+        },
+        type: {
+            type: String,
+            default: "user"
         },
+        isChoose:{
+            type:Boolean,
+            default:false
+        },
+        submitId:{
+            type:Number,
+            default:0
+        }
     },
     data() {
         return {};
     },
+    computed: {
+        endTime() {
+            return formatTime(this.info.endTime);
+        },
+
+    },
+    methods: {
+        goUse() {
+            if (this.stauts == 0) {
+                if (this.type == "user") {
+                    wx.switchTab({
+                        url: "/pages/home/home"
+                    });
+                } else {
+                    this.$emit("chooseId", this.submitId);
+                }
+            }
+        }
+    }
 };
 </script>
 <style lang='less' scoped>
@@ -52,7 +90,7 @@ export default {
     line-height: 124rpx;
     margin-left: 34rpx;
     &::before {
-        content: '¥';
+        content: "¥";
         font-size: 32rpx;
         font-weight: normal;
         color: #00c5f2;
@@ -130,8 +168,14 @@ export default {
         font-weight: normal;
     }
 
-    .time{
+    .time {
         color: #fff;
     }
 }
+
+.chooseImg{
+    width:22px ;
+    height: 22px;
+    margin: 0 15px ;
+}
 </style>

+ 5 - 0
src/pages/couponList/couponList.js

@@ -0,0 +1,5 @@
+import Vue from 'vue'
+import App from './couponList.vue'
+
+const app = new Vue(App)
+app.$mount()

+ 3 - 0
src/pages/couponList/couponList.json

@@ -0,0 +1,3 @@
+{
+    "navigationBarTitleText": "优惠券列表"
+}

+ 51 - 0
src/pages/couponList/couponList.vue

@@ -0,0 +1,51 @@
+<template>
+    <div class="container">
+        <coupon
+            v-for="(item,index) in couponList"
+            :key="index"
+            :info="item"
+            @updateCoupon="getCoupon"
+        ></coupon>
+    </div>
+</template>
+<script>
+import { mapState } from "vuex";
+import coupon from "../../components/Coupon";
+export default {
+    name: "couponList",
+    data() {
+        return {
+            couponList: []
+        };
+    },
+    computed: {
+        ...mapState(["userInfo"])
+    },
+    onLoad() {
+        this.getCoupon();
+    },
+    methods: {
+        getCoupon() {
+            var data = {
+                receiveFlag: "N",
+                userId: this.$store.state.userInfo.id,
+                onShelf: "Y",
+                checkTime:1
+            };
+            this.$http.get("/couponInfo/all", data).then(res => {
+                if (res.success) {
+                    this.couponList = res.data;
+                }
+            });
+        }
+    },
+    components: {
+        coupon
+    }
+};
+</script>
+<style lang='less' scoped>
+.container{
+    background-color: #fff;
+}
+</style>

+ 641 - 64
src/pages/examinePhotos/examinePhotos.vue

@@ -1,89 +1,318 @@
 <template>
-    <div class='container'>
+    <div class="container">
         <div class="top">
             <div class="banner">
-                <div class="banner-left">No.{{current+1}}/共{{imgList.length}}张</div>
-                <div class="banner-right">已选择:23张</div>
+                <div class="banner-left">
+                    No.{{current+1}}/共{{allAlbumImage.length+allOrderImage.length}}张
+                </div>
+                <div class="banner-right">已选择:{{chooseList.length}}张</div>
             </div>
         </div>
-        <swiper class="swiper" :current='current' @change='changeSwiper'>
-            <swiper-item v-for="(item,index) in imgList" :key="index" class="slide-image">
+        <swiper class="swiper" :current="current" @change="changeSwiper">
+            <swiper-item v-for="(item,index) in orderImage" :key="index"
+                class="slide-image">
                 <div class="imgContent">
-                    <img :src="item" class="img" background-size="contain" background-position="center center" @click="showImg(index)">
-                    <img src="/static/images/icon_chengpian.png" class="icon" alt="">
+                    <img :src="item.finishedImage" class="img"
+                        background-size="contain"
+                        background-position="center center"
+                        @click="showImg('finishedImage','image')" />
+                    <img src="/static/images/icon_chengpian.png" class="icon"
+                        alt />
                 </div>
 
-                <div class="imgContent">
-                    <img :src="item" class="img" background-size="contain" background-position="center center" @click="showImg(index)">
-                    <img src="/static/images/icon_yuanpian.png" class="icon" alt="">
+                <button v-if="!showOriginalImage" class="showBtn"
+                    @click="showOriginalImage=true">原片对比</button>
+
+                <div class="imgContent" v-else>
+                    <img :src="item.originalImage" class="img"
+                        background-size="contain"
+                        background-position="center center"
+                        @click="showImg('originalImage','image')" />
+                    <img src="/static/images/icon_yuanpian.png" class="icon"
+                        alt />
                 </div>
-                <div class="imgTitle">
-                    IMG_1101.jpg
+                <div class="imgTitle">{{imageName}}</div>
+            </swiper-item>
+
+            <swiper-item v-for="(item,index) in albumImage" :key="index"
+                class="slide-image">
+                <div class="imgContent">
+                    <img :src="item.finishedImage" class="img"
+                        background-size="contain"
+                        background-position="center center"
+                        @click="showImg('finishedImage','album')" />
+                    <img src="/static/images/icon_fangda.png" class="icon"
+                        alt />
                 </div>
+                <div class="imgTitle">IMG_1101.jpg</div>
             </swiper-item>
         </swiper>
-        <img class="left" v-if="current>0" @click="goPre" src="/static/images/icon_shangyiye_dis.png" alt="">
-        <img class="right" @click="goNext" src="/static/images/icon_xiayiye_dis.png" alt="">
+        <img class="left" v-if="current>0" @click="goPre"
+            src="/static/images/icon_shangyiye_dis.png" alt />
+        <img class="right" v-if="canNext" @click="goNext"
+            src="/static/images/icon_xiayiye_dis.png" alt />
+        <img class="right" v-else-if="canSubmit" @click="submit"
+            src="/static/images/icon_xiayiye_dis.png" alt />
         <div class="bottom">
-            <div class="message" :class="{notSet:!message}" @click="showMessage=true">
-                {{message}}
-            </div>
+            <div class="message" :class="{notSet:!message}"
+                @click="showMessage=true">{{message}}</div>
 
             <div class="btnList">
-                <div class="btn noPass" :class="{active:noPass}"  @click="noPass=!noPass">
-                    <img :src="noPassImg" alt="">
+                <div class="btn noPass" :class="{active:noPass}"
+                    @click="noPassInfo">
+                    <img :src="noPassImg" alt />
                     <span>不通过</span>
                 </div>
-                <div class="btn pass" :class="{active:pass}" @click="pass=!pass">
-                    <img :src="passImg" alt="">
+                <div class="btn pass" :class="{active:pass}" @click="passInfo">
+                    <img :src="passImg" alt />
                     <span>通过</span>
                 </div>
             </div>
         </div>
 
-        <messageContent :visible='showMessage' @close='showMessage=false' @submit='submit'></messageContent>
+        <messageContent :visible="showMessage" @close="showMessage=false"
+            @submit="textChange"></messageContent>
     </div>
 </template>
 <script>
-import { mapState } from 'vuex';
-import messageContent from '../../components/Message';
+import { mapState } from "vuex";
+import messageContent from "../../components/Message";
 export default {
-    name: '',
+    name: "",
     data() {
         return {
-            imgList: [
-                'https://bpic.588ku.com/illus_water_img/19/07/04/923c38ece95e492a51d77f6c595d4663.jpg',
-                'https://bpic.588ku.com/illus_water_img/19/06/05/cbe3f85497904ff30119a6dd4884024a.jpg',
-                'https://bpic.588ku.com/illus_water_img/19/06/14/de14f437789722334a0cc5ea02048ca7.jpg',
-                'https://bpic.588ku.com/illus_water_img/19/06/07/470ac937b435c696545ffb12e7bda675.jpg',
-                'https://bpic.588ku.com/illus_water_img/19/06/25/c64d4b4c8be8c62ff6806c449bcf7ec3.jpg',
-            ],
             current: 0,
-            message: '',
-            isChoose: false,
             showMessage: false,
-            noPass: false,
-            pass: false,
+            allOrderImage: [],
+            orderInfo: {
+                orderRepairList: [],
+                orderAlbumRepairList: []
+            },
+            allAlbumImage: [],
+            showOriginalImage: false,
+            isNoPass: false,
+            albumRepairId: 0,
+            imageRepairId: 0
         };
     },
     computed: {
-        ...mapState(['userInfo']),
+        ...mapState(["userInfo"]),
         noPassImg() {
-            var img = require('../../../static/images/dingdan_icon_butongguo4.png');
+            var img = require("../../../static/images/dingdan_icon_butongguo4.png");
             if (this.noPass) {
-                img = require('../../../static/images/dingdan_icon_butongguo2.png');
+                img = require("../../../static/images/dingdan_icon_butongguo2.png");
             }
 
             return img;
         },
         passImg() {
-            var img = require('../../../static/images/dingdan_icon_butongguo3.png');
+            var img = require("../../../static/images/dingdan_icon_butongguo3.png");
             if (this.pass) {
-                img = require('../../../static/images/dingdan_icon_butongguo1.png');
+                img = require("../../../static/images/dingdan_icon_butongguo1.png");
             }
 
             return img;
         },
+        orderImage() {
+            var list = [];
+            var allList = [...this.allOrderImage];
+            for (var i = 0; i < allList.length; i++) {
+                if (allList[i].statusFlag == 0) {
+                    list.push(allList[i]);
+                    break;
+                } else {
+                    list.push(allList[i]);
+                }
+            }
+            return list;
+        },
+        albumImage() {
+            var list = [];
+            if (this.allOrderImage.length > 0) {
+                if (
+                    this.allOrderImage[this.allOrderImage.length - 1]
+                        .statusFlag != 0
+                ) {
+                    var allList = [...this.allAlbumImage];
+                    for (var i = 0; i < allList.length; i++) {
+                        if (allList[i].statusFlag == 0) {
+                            list.push(allList[i]);
+                            break;
+                        } else {
+                            list.push(allList[i]);
+                        }
+                    }
+                }
+            }
+            return list;
+        },
+        canNext() {
+            if (
+                this.current <
+                this.orderImage.length + this.albumImage.length - 1
+            ) {
+                return true;
+            } else {
+                return false;
+            }
+        },
+        chooseList() {
+            var list = [];
+            var allList = [...this.allOrderImage];
+            var AlbumImage = [...this.allAlbumImage];
+            allList.forEach(item => {
+                if (item.statusFlag != 0) {
+                    list.push(item);
+                }
+            });
+            AlbumImage.forEach(item => {
+                if (item.statusFlag != 0) {
+                    list.push(item);
+                }
+            });
+
+            return list;
+        },
+        pass() {
+            var list = [...this.imgList];
+            if (list.length > this.current) {
+                if (list[this.current].statusFlag == 1) {
+                    return true;
+                } else {
+                    return false;
+                }
+            } else {
+                return false;
+            }
+        },
+        imageName() {
+            var list = [...this.imgList];
+            if (list.length > 0) {
+                return list[this.current].imageName || "";
+            } else {
+                return "";
+            }
+        },
+        imgList() {
+            var orderImage = [...this.orderImage];
+            var albumImage = [...this.albumImage];
+            var list = orderImage.concat(albumImage);
+            return list;
+        },
+        noPass() {
+            var list = [...this.imgList];
+            if (list.length > this.current) {
+                if (list[this.current].statusFlag == 2) {
+                    return true;
+                } else {
+                    return false;
+                }
+            } else {
+                return false;
+            }
+        },
+        message() {
+            var list = [...this.imgList];
+            if (list.length > 0) {
+                return list[this.current].detailRemark || "";
+            } else {
+                return "";
+            }
+        },
+        canSubmit() {
+            if (
+                this.imgList.length ==
+                    this.allOrderImage.length + this.allAlbumImage.length &&
+                this.imgList.length != 0 &&
+                this.imgList[this.imgList.length - 1].statusFlag != 0
+            ) {
+                return true;
+            } else {
+                return false;
+            }
+        },
+        repaireList() {
+            var list1 = [...this.orderInfo.orderAlbumRepairList];
+            var list2 = [...this.orderInfo.orderRepairList];
+            list1 = list1.filter(item => {
+                return item.statusFlag;
+            });
+            list2 = list2.filter(item => {
+                return item.statusFlag;
+            });
+
+            return list1.length > list2.length ? list1.length : list2.length;
+        }
+    },
+    onLoad(options) {
+        this.current = 0;
+        this.showOriginalImage = false;
+        if (options.orderId) {
+            this.orderId = options.orderId;
+        }
+        if (options.albumRepairId) {
+            this.albumRepairId = options.albumRepairId;
+        }
+        if (options.imageRepairId) {
+            this.imageRepairId = options.imageRepairId;
+        }
+        this.$http
+            .get("/userOrderDetail/getOne", {
+                id: this.orderId
+            })
+            .then(res => {
+                if (res.success) {
+                    this.orderInfo = res.data;
+                }
+            });
+        this.$http
+            .get(
+                "/orderImage/all",
+                {
+                    orderId: this.orderId,
+                    selectFlag: "Y",
+                    repaireId: this.imageRepairId || ""
+                },
+                {},
+                false
+            )
+            .then(res => {
+                if (res.success) {
+                    this.allOrderImage = res.data.map((item, index) => {
+                        return {
+                            ...item,
+                            index: index,
+                            imgType: "orderImage"
+                        };
+                    });
+                }
+            });
+
+        this.$http
+            .get(
+                "/orderAlbum/all",
+                {
+                    orderId: this.orderId,
+                    repaireId: this.albumRepairId || ""
+                },
+                {},
+                false
+            )
+            .then(res => {
+                if (res.success) {
+                    this.allAlbumImage = res.data.map((item, index) => {
+                        return {
+                            ...item,
+                            index: index,
+                            imgType: "orderAlbum"
+                        };
+                    });
+                }
+            });
+
+        // setTimeout(()=>{
+        //     this.current=59
+        // },1000)
     },
     methods: {
         goPre() {
@@ -98,20 +327,356 @@ export default {
         changeSwiper(e) {
             this.current = e.mp.detail.current;
         },
-        submit(text) {
+        textChange(text) {
             console.log(text);
-            this.showMessage = false;
+            var img = this.imgList[this.current];
+            var data = {
+                id: img.id,
+                orderId: img.orderId,
+                userId: img.userId,
+                statusFlag: 2
+                // detailRemark: this.remark
+            };
+            if (text) {
+                data.detailRemark = text;
+            }
+
+            if (!this.isNoPass) {
+                data.detailRemarkFlag = 1;
+            } else {
+                this.isNoPass = false;
+            }
+
+            var isAlbum = false;
+            if (img.imgType == "orderAlbum") {
+                isAlbum = true;
+            }
+            console.log(data);
+            this.$http
+                .post(
+                    isAlbum ? "/orderAlbum/repair" : "/orderImage/repair",
+                    data
+                )
+                .then(res => {
+                    if (res.success) {
+                        this.showMessage = false;
+                        this.getInfo("next");
+                    } else {
+                    }
+                });
         },
-        showImg(index) {
+        showImg(src, type) {
+            console.log(src, type);
+            console.log(this.imgList);
+            console.log(this.current);
+            var imgList = [];
+            var imgSrc = "";
+            if (type == "image") {
+                if (src == "finishedImage") {
+                    imgSrc = this.imgList[this.current].finishedImage;
+                    imgList = [imgSrc];
+                } else {
+                    imgSrc = this.imgList[this.current].originalImage;
+                    imgList = [imgSrc];
+                }
+            } else {
+                imgSrc = this.imgList[this.current].finishedImage;
+                imgList = [this.imgList[this.current].finishedImage];
+            }
             wx.previewImage({
-                current: index, // 当前显示图片的http链接
-                urls: this.imgList, // 需要预览的图片http链接列表
+                current: imgSrc, // 当前显示图片的http链接
+                urls: imgList // 需要预览的图片http链接列表
+            });
+        },
+        getInfo(type) {
+            var isAlbum = false;
+            var img = this.imgList[this.current];
+            if (img.imgType == "orderAlbum") {
+                isAlbum = true;
+            }
+            this.$http
+                .get(
+                    isAlbum ? "/orderAlbum/getOne" : "/orderImage/getOne",
+                    {
+                        id: img.id
+                    },
+                    {},
+                    false
+                )
+                .then(res => {
+                    if (res.success) {
+                        if (isAlbum) {
+                            this.$set(this.allAlbumImage, img.index, res.data);
+                        } else {
+                            this.$set(this.allOrderImage, img.index, res.data);
+                        }
+
+                        if (
+                            type == "next" &&
+                            this.imgList.length <
+                                this.allOrderImage.length +
+                                    this.allAlbumImage.length
+                        ) {
+                            wx.showToast({
+                                title: "成功",
+                                icon: "success",
+                                duration: 1500
+                            });
+                            this.current++;
+                        }
+                    } else {
+                    }
+                });
+        },
+        passInfo() {
+            if (this.pass) {
+                return;
+            }
+
+            var img = this.imgList[this.current];
+
+            var data = {
+                id: img.id,
+                orderId: img.orderId
+            };
+
+            var isAlbum = false;
+
+            if (img.imgType == "orderAlbum") {
+                isAlbum = true;
+            }
+            this.$http
+                .post(
+                    isAlbum ? "/orderAlbum/pass" : "/orderImage/pass",
+                    data,
+                    {},
+                    false
+                )
+                .then(res => {
+                    if (res.success) {
+                        this.getInfo("next");
+                    } else {
+                    }
+                });
+        },
+        noPassInfo() {
+            if (this.noPass) {
+                return;
+            }
+            this.showMessage = true;
+            this.isNoPass = true;
+        },
+        submit() {
+            this.$http
+                .get(
+                    "userOrderDetail/checkRepairImageAndAlbum",
+                    {
+                        orderId: this.orderId,
+                        selectFlag: "Y",
+                        repairId: this.imageRepairId || "",
+                        albumRepairId: this.albumRepairId || ""
+                    },
+                    {},
+                    false
+                )
+                .then(res => {
+                    var ref = this;
+                    if (res.success) {
+                        if (res.data.failAlbum + res.data.failImage != 0) {
+                            var info = res.data;
+                            wx.showModal({
+                                title: "提示",
+                                content:
+                                    "确认提交第" +
+                                    (this.repaireList + 1) +
+                                    "次返修",
+                                success(res) {
+                                    if (res.confirm) {
+                                        ref.repaire(info);
+                                    } else if (res.cancel) {
+                                        console.log("用户点击取消");
+                                    }
+                                }
+                            });
+                        } else {
+                            wx.showModal({
+                                title: "提示",
+                                content: "确认全部审核通过",
+                                success(res) {
+                                    if (res.confirm) {
+                                        ref.allPass();
+                                    } else if (res.cancel) {
+                                        console.log("用户点击取消");
+                                    }
+                                }
+                            });
+                        }
+                    }
+                });
+        },
+        allPass() {},
+        repaire(info) {
+            wx.showLoading({
+                title: "加载中",
+                mask: true
+            });
+            // wx.hideLoading();
+            // wx.showToast({
+            //     title: "审核成功",
+            //     icon: "success",
+            //     duration: 1500
+            // });
+            // setTimeout(() => {
+            //     wx.navigateBack();
+            // }, 1500);
+            var repairAcceptType = "";
+            if (info.failImage > 0) {
+                repairAcceptType = "order_image";
+            }
+            if (info.failAlbum > 0) {
+                repairAcceptType = "order_album";
+            }
+
+            if (info.failImage > 0 && info.failAlbum > 0) {
+                repairAcceptType = "image_album";
+            }
+            this.userOrderDetailRepair(info, {
+                id: this.orderId,
+                acceptType: repairAcceptType
+            })
+                .then(() => {
+                    console.log("repaire成功");
+                    if (this.imageRepairId || this.albumRepairId) {
+                        this.updateImageAndAlbumRepair(info)
+                            .then(() => {
+                                console.log("update成功");
+                                this.userOrderDetailConfirm(info)
+                                    .then(() => {
+                                        console.log("comfirm成功");
+                                        wx.hideLoading();
+                                        wx.showToast({
+                                            title: "审核成功",
+                                            icon: "success",
+                                            duration: 1500
+                                        });
+                                        setTimeout(() => {
+                                            wx.navigateBack();
+                                        }, 1500);
+                                    })
+                                    .catch(() => {
+                                        wx.hideLoading();
+                                    });
+                            })
+                            .catch(() => {
+                                wx.hideLoading();
+                            });
+                    } else {
+                        this.userOrderDetailConfirm(info)
+                            .then(() => {
+                                console.log("comfirm成功");
+                                wx.hideLoading();
+                                wx.showToast({
+                                    title: "审核成功",
+                                    icon: "success",
+                                    duration: 1500
+                                });
+                                setTimeout(() => {
+                                    wx.navigateBack();
+                                }, 1500);
+                            })
+                            .catch(() => {
+                                wx.hideLoading();
+                            });
+                    }
+                })
+                .catch(() => {
+                    wx.hideLoading();
+                });
+        },
+        userOrderDetailRepair(info, data) {
+            return new Promise((resolve, reject) => {
+                if (info.failImage > 0 || info.failAlbum > 0) {
+                    this.$http
+                        .post("/userOrderDetail/repair", data, {}, false)
+                        .then(res => {
+                            if (res.success) {
+                                resolve();
+                            } else {
+                                reject();
+                            }
+                        });
+                } else {
+                    resolve();
+                }
             });
         },
+        updateImageAndAlbumRepair(info) {
+            return new Promise((resolve, reject) => {
+                var data = {};
+                if (this.albumRepairId) {
+                    data.albumRepairId = this.albumRepairId;
+                    data.albumRepairStatus = 3;
+                }
+
+                if (this.imageRepairId) {
+                    data.imageRepairId = this.imageRepairId;
+                    data.imageRepairStatus = 3;
+                }
+                this.$http
+                    .post(
+                        "/userOrderDetail/updateImageAndAlbumRepair",
+                        data,
+                        {},
+                        false
+                    )
+                    .then(res => {
+                        if (!res.success) {
+                            reject();
+                        } else {
+                            resolve();
+                        }
+                    });
+            });
+        },
+        userOrderDetailConfirm(info) {
+            return new Promise((resolve, reject) => {
+                var confirmAcceptType = "";
+
+                if (info.failImage == 0) {
+                    confirmAcceptType = "order_image";
+                }
+
+                if (info.failAlbum == 0) {
+                    confirmAcceptType = "order_album";
+                }
+
+                if (info.failImage == 0 && info.failAlbum == 0) {
+                    confirmAcceptType = "image_album";
+                }
+
+                this.$http
+                    .post(
+                        "/userOrderDetail/confirm",
+                        {
+                            id: this.orderId,
+                            acceptType: confirmAcceptType
+                        },
+                        {},
+                        false
+                    )
+                    .then(res => {
+                        if (!res.success) {
+                            reject();
+                        } else {
+                            resolve();
+                        }
+                    });
+            });
+        }
     },
     components: {
-        messageContent,
-    },
+        messageContent
+    }
 };
 </script>
 <style lang='less' scoped>
@@ -231,7 +796,7 @@ export default {
 
     &.notSet {
         &::before {
-            content: '输入备注内容';
+            content: "输入备注内容";
             color: rgba(170, 172, 173, 1);
         }
     }
@@ -241,7 +806,7 @@ export default {
     display: flex;
     align-items: center;
     justify-content: space-between;
-    padding:8px 15px;
+    padding: 8px 15px;
 
     .btn {
         width: 165px;
@@ -267,30 +832,42 @@ export default {
 
         &.noPass {
             border-color: #fb6e08;
-            span{
-                color: #fb6e08
+            span {
+                color: #fb6e08;
             }
 
-            &.active{
-              background-color: #fb6e08;
-              span{
-                  color: #fff;
-              }  
+            &.active {
+                background-color: #fb6e08;
+                span {
+                    color: #fff;
+                }
             }
         }
         &.pass {
             border-color: #00c5f2;
-            span{
-                color: #00c5f2
+            span {
+                color: #00c5f2;
             }
 
-             &.active{
-              background-color: #00c5f2;
-              span{
-                  color: #fff;
-              }  
+            &.active {
+                background-color: #00c5f2;
+                span {
+                    color: #fff;
+                }
             }
         }
     }
 }
+.showBtn {
+    width: 100px;
+    height: 32px;
+    background: rgba(0, 197, 242, 0.1);
+    border-radius: 4px;
+    border: 1px solid rgba(0, 197, 242, 1);
+    font-size: 13px;
+    color: rgba(0, 197, 242, 1);
+    line-height: 32px;
+    font-weight: bold;
+    margin: 26px 0 0;
+}
 </style>

+ 4 - 1
src/pages/home/home.vue

@@ -29,7 +29,7 @@
             <advertisingSpace></advertisingSpace>
 
             <div class="linearBg">
-                <!-- <homeCoupon></homeCoupon> -->
+                <homeCoupon></homeCoupon>
                 <div v-for="(item,index) in homeProductList" :key='index'>
 
                     <div class="hot" v-if="item.typeFlag==0">
@@ -134,6 +134,8 @@ export default {
             .catch(e => {
                 console.log(e);
             });
+      
+            
     },
     onReachBottom() {
         // if (this.homeFlag) {
@@ -142,6 +144,7 @@ export default {
         // }
     },
     methods: {
+        
         clearInput() {},
         getHot() {
             this.hotFlag = false;

+ 83 - 12
src/pages/myCoupon/myCoupon.vue

@@ -1,26 +1,97 @@
 <template>
-    <div class='container'>
-        <myCoupon></myCoupon>
-        <myCoupon></myCoupon>
+    <div class="container">
+        
+        <myCoupon v-for="(item,index) in canUseList" :key="index" :info="item.couponInfo"></myCoupon>
 
-        <div class="couponTitle">以下优惠券不可使用</div>
-        <myCoupon :stauts='1'></myCoupon>
+        <div v-if="notUseList.length>0">
+            <div class="couponTitle">以下优惠券不可使用</div>
+            <myCoupon
+                :stauts="1"
+                v-for="(item,index) in notUseList"
+                :key="index"
+                :info="item.couponInfo"
+            ></myCoupon>
+        </div>
+
+        <view class="weui-loadmore" v-if='loading'>
+                <view class="weui-loading"></view>
+                <view class="weui-loadmore__tips">正在加载</view>
+            </view>
+
+            <div class="nothing" v-if="couponList.length==0&&!loading">
+            <img src="/static/images/kong_icon_dingdan.png" alt="">
+            <div class="title">暂无优惠券</div>
+            <div class="sub">快去首页领取优惠券吧</div>
+            <button @click="goHome">去逛逛</button>
+        </div>
     </div>
 </template>
 <script>
-import { mapState } from 'vuex';
-import myCoupon from '../../components/MyCoupon';
+import { mapState } from "vuex";
+import myCoupon from "../../components/MyCoupon";
 export default {
-    name: '',
+    name: "",
     data() {
-        return {};
+        return {
+            couponList: [],
+            loading:true
+        };
     },
     computed: {
-        ...mapState(['userInfo']),
+        ...mapState(["userInfo"]),
+        canUseList() {
+            var list = [];
+            var allList = [...this.couponList];
+            var date = Date.parse(new Date());
+            allList.forEach(item => {
+                if (
+                    item.couponInfo.beginTime <= date &&
+                    item.couponInfo.endTime >= date
+                ) {
+                    list.push(item);
+                }
+            });
+            return list;
+        },
+        notUseList() {
+            var list = [];
+            var allList = [...this.couponList];
+            var date = Date.parse(new Date());
+            allList.forEach(item => {
+                if (
+                    item.couponInfo.beginTime > date ||
+                    item.couponInfo.endTime < date
+                ) {
+                    list.push(item);
+                }
+            });
+            return list;
+        }
     },
-    components: {
-        myCoupon,
+    onLoad() {
+        this.loading=true;
+        this.$http
+            .get("/userCoupon/all", {
+                userId: this.userInfo.id,
+                isUsed: "N"
+            })
+            .then(res => {
+                this.loading=false;
+                if (res.success) {
+                    this.couponList = res.data;
+                }
+            });
     },
+    methods:{
+        goHome(){
+            wx.switchTab({
+                url: '/pages/home/home',
+            });
+        }
+    },
+    components: {
+        myCoupon
+    }
 };
 </script>
 <style lang='less' scoped>

+ 296 - 161
src/pages/orderDetail/orderDetail.vue

@@ -1,14 +1,15 @@
 <template>
     <div class="container">
         <div class="top">
-            <div class="statusList" :style="{transform:'translateX('+(0-2*transFormLeft)+'rpx)'}">
-                <div class="statusItem" :class="{select:statusFlag==item.type}" v-for="(item,index) in statusList" :key="index">
+            <div class="statusList"
+                :style="{transform:'translateX('+(0-2*transFormLeft)+'rpx)'}">
+                <div class="statusItem" :class="{select:statusFlag==item.type}"
+                    v-for="(item,index) in statusList" :key="index">
                     <div class="img">
-                        <img :src="item.img" alt="">
+                        <img :src="item.img" alt />
                         <div class="line"></div>
                     </div>
                     <div class="title">{{item.name}}</div>
-
                 </div>
             </div>
         </div>
@@ -16,30 +17,33 @@
         <div class="messageInfo">
             <div class="bookingInfo" v-if="bookingTimeText">
                 <div>{{bookingTimeText}}</div>
-                <div>
-                    店铺地址:{{address}}
-                </div>
-                <img class="daohang" @click="goLocation" src="/static/images/icon_daohang (1).png" alt="">
+                <div>店铺地址:{{address}}</div>
+                <img class="daohang" @click="goLocation"
+                    src="/static/images/icon_daohang (1).png" alt />
+            </div>
+            <div class="text"
+                :style="{textAlign:text.length<18?'center':'left'}">{{text}}
             </div>
-            <div class="text" :style="{textAlign:text.length<18?'center':'left'}">{{text}}</div>
             <div class="btnList">
                 <div class="btn-item">
-                    <img src="/static/images/xiangqing_icon_kefu.png" alt="">
+                    <img src="/static/images/xiangqing_icon_kefu.png" alt />
                     <span>在线咨询</span>
-                    <button open-type="contact" class="hide"> 客服</button>
+                    <button open-type="contact" class="hide">客服</button>
                 </div>
 
                 <div class="btn-line"></div>
 
                 <div class="btn-item" @click="takePhone">
-                    <img src="/static/images/xiangqing_icon_kefu(1).png" alt="">
+                    <img src="/static/images/xiangqing_icon_kefu(1).png" alt />
                     <span>拨打电话</span>
                 </div>
             </div>
         </div>
 
         <div class="orderInfo">
-            <subOrder :list='userOrderDetailList' type='order' :productMoney='productMoney' @changeMessage='changeMessage'></subOrder>
+            <subOrder :list="userOrderDetailList" type="order"
+                :productMoney="productMoney" @changeMessage="changeMessage">
+            </subOrder>
         </div>
 
         <div class="payInfo">
@@ -67,96 +71,129 @@
         </div>
 
         <div class="fixedBottom">
+            <div class="bottomBtnList"
+                v-if="orderInfo.statusFlag==orderStatus.PHOTOOVER&&orderInfo.albumStatus==orderAlbumStatus.WAITSELECT">
+                <button class="default" @click="bookingTime">预约线下选片</button>
+                <button class="primary" @click="selectPhoto"
+                    v-if="orderInfo.albumStatus==orderAlbumStatus.WAITSELECT">在线选片</button>
+                <button class="primaryDis"
+                    v-else-if="orderInfo.albumStatus==orderAlbumStatus.REWORK">返修中</button>
+                <button class="primary" v-else>返修审片</button>
+            </div>
+            <div class="submitBtn"
+                v-else-if="orderInfo.statusFlag==orderStatus.BOOKSELECT&&orderInfo.albumStatus==orderAlbumStatus.WAITSELECT">
+                <button class="primary" @click="selectPhoto">在线选片</button>
+            </div>
 
-            <div class="submitBtn" v-if="hasBookBtn">
-                <button @click="bookingTime">{{btnText}}</button>
-                <!-- <picker class="picker" mode="date" :start="nowDate" @change="bindDateChange">
-                    <view>
-                        当前选择: {{date}}
-                    </view>
-                </picker> -->
+            <div class="bottomBtnList"
+                v-else-if="orderInfo.statusFlag==orderStatus.SELECTOVER&& (orderInfo.albumStatus==orderAlbumStatus.WAITACCEPT||orderInfo.albumStatus==orderAlbumStatus.REWORK||orderInfo.albumStatus==orderAlbumStatus.REWORKACCEPT)">
+                <button class="default" @click="bookingTime">预约线下审片</button>
+                <button class="primary" @click="examinePhoto"
+                    v-if="orderInfo.albumStatus==orderAlbumStatus.WAITACCEPT">在线审片</button>
+                <button class="primaryDis"
+                    v-else-if="orderInfo.albumStatus==orderAlbumStatus.REWORK">返修中</button>
+                <button class="primary" @click="examinePhoto"
+                    v-else>返修审片</button>
             </div>
 
-            <button v-if="statusName=='待评价'" class="submit" @click="goEvaluate">立即评价</button>
-            <button v-if="statusName=='待支付'" class="submit" @click="goPay">立即支付</button>
+            <div class="submitBtn"
+                v-else-if="orderInfo.statusFlag==orderStatus.BOOKCHECK&& (orderInfo.albumStatus==orderAlbumStatus.WAITACCEPT||orderInfo.albumStatus==orderAlbumStatus.REWORK||orderInfo.albumStatus==orderAlbumStatus.REWORKACCEPT)">
+                <button class="primary" @click="examinePhoto"
+                    v-if="orderInfo.albumStatus==orderAlbumStatus.WAITACCEPT">在线审片</button>
+                <button class="primaryDis"
+                    v-else-if="orderInfo.albumStatus==orderAlbumStatus.REWORK">返修中</button>
+                <button class="primary" @click="examinePhoto"
+                    v-else>返修审片</button>
+            </div>
+            <div class="submitBtn" v-else-if="hasBookBtn">
+                <button @click="bookingTime">{{btnText}}</button>
+            </div>
 
+            <button v-if="statusName=='待评价'" class="submit"
+                @click="goEvaluate">立即评价</button>
+            <button v-if="statusName=='待支付'" class="submit"
+                @click="goPay">立即支付</button>
         </div>
-
     </div>
 </template>
 
 <script>
-import { mapState } from 'vuex';
-import subOrder from '../../components/SubOrder';
-import { OrderStatus, PayMode } from '../../Constants';
-import { formatTime } from '../../time';
+import { mapState } from "vuex";
+import subOrder from "../../components/SubOrder";
+import { OrderStatus, PayMode, OrderAlbumStatus } from "../../Constants";
+import { formatTime } from "../../time";
 export default {
     data() {
         return {
             orderId: 0,
-            orderInfo: {},
+            orderInfo: {
+                orderRepairList: [],
+                orderAlbumRepairList: []
+            },
             statusList: [
                 {
-                    name: '支付',
+                    name: "支付",
                     type: OrderStatus.NOPAY,
-                    img: require('../../../static/images/dingdan_icon_yuyue(1).png'),
+                    img: require("../../../static/images/dingdan_icon_yuyue(1).png")
                 },
                 {
-                    name: '预约拍照',
+                    name: "预约拍照",
                     type: OrderStatus.PAYOVER,
-                    img: require('../../../static/images/dingdan_icon_yuyue.png'),
+                    img: require("../../../static/images/dingdan_icon_yuyue.png")
                 },
                 {
-                    name: '拍照',
+                    name: "拍照",
                     type: OrderStatus.BOOKPHOTO,
-                    img: require('../../../static/images/dingdan_icon_paizhao.png'),
+                    img: require("../../../static/images/dingdan_icon_paizhao.png")
                 },
                 {
-                    name: '预约选片',
+                    name: "预约选片",
                     type: OrderStatus.PHOTOOVER,
-                    img: require('../../../static/images/dingdan_icon_yuyue.png'),
+                    img: require("../../../static/images/dingdan_icon_yuyue.png")
                 },
                 {
-                    name: '选片',
+                    name: "选片",
                     type: OrderStatus.BOOKSELECT,
-                    img: require('../../../static/images/dingdan_icon_xuanpian.png'),
+                    img: require("../../../static/images/dingdan_icon_xuanpian.png")
                 },
                 {
-                    name: '预约审片',
+                    name: "预约审片",
                     type: OrderStatus.SELECTOVER,
-                    img: require('../../../static/images/dingdan_icon_yuyue.png'),
+                    img: require("../../../static/images/dingdan_icon_yuyue.png")
                 },
                 {
-                    name: '审片',
+                    name: "审片",
                     type: OrderStatus.BOOKCHECK,
-                    img: require('../../../static/images/dingdan_icon_shenpian.png'),
+                    img: require("../../../static/images/dingdan_icon_shenpian.png")
                 },
                 {
-                    name: '预约取件',
+                    name: "预约取件",
                     type: OrderStatus.CHECKOVER,
-                    img: require('../../../static/images/dingdan_icon_yuyue.png'),
+                    img: require("../../../static/images/dingdan_icon_yuyue.png")
                 },
                 {
-                    name: '取件',
+                    name: "取件",
                     type: OrderStatus.BOOKACCESS,
-                    img: require('../../../static/images/dingdan_icon_paizhao(2).png'),
+                    img: require("../../../static/images/dingdan_icon_paizhao(2).png")
                 },
                 {
-                    name: '评价',
+                    name: "评价",
                     type: OrderStatus.ACCESSOVER,
-                    img: require('../../../static/images/dingdan_icon_paizhao(1).png'),
-                },
+                    img: require("../../../static/images/dingdan_icon_paizhao(1).png")
+                }
             ],
-            address: '',
-            latitude: '',
-            longitude: '',
-            storeName: '',
+            address: "",
+            latitude: "",
+            longitude: "",
+            storeName: "",
             userOrderidList: [],
-            userOrderId: '',
+            userOrderId: "",
+            orderStatus: OrderStatus,
+            orderAlbumStatus: OrderAlbumStatus
         };
     },
     computed: {
-        ...mapState(['userInfo', 'storeInfo']),
+        ...mapState(["userInfo", "storeInfo"]),
         transFormLeft() {
             var left = this.statusFlag * 66;
             var allLength = this.statusList.length * 66 - 30;
@@ -177,11 +214,11 @@ export default {
             return this.orderInfo.id ? [this.orderInfo] : [];
         },
         payMode() {
-            var mode = '';
+            var mode = "";
             if (PayMode.WEI_XIN == this.orderInfo.payMode) {
-                mode = '微信';
+                mode = "微信";
             } else if (PayMode.COIN == this.orderInfo.payMode) {
-                mode = '余额';
+                mode = "余额";
             }
 
             return mode;
@@ -199,91 +236,91 @@ export default {
             return this.productInfo.storeInfo || {};
         },
         statusName() {
-            var name = '';
+            var name = "";
             if (this.orderInfo.statusFlag == OrderStatus.NOPAY) {
-                name = '待支付';
+                name = "待支付";
             } else if (this.orderInfo.statusFlag == OrderStatus.PAYOVER) {
-                name = '待预约拍照';
+                name = "待预约拍照";
             } else if (this.orderInfo.statusFlag == OrderStatus.BOOKPHOTO) {
-                name = '待拍照';
+                name = "待拍照";
             } else if (this.orderInfo.statusFlag == OrderStatus.PHOTOOVER) {
-                name = '待预约选片';
+                name = "待预约选片";
             } else if (this.orderInfo.statusFlag == OrderStatus.BOOKSELECT) {
-                name = '待选片';
+                name = "待选片";
             } else if (this.orderInfo.statusFlag == OrderStatus.SELECTOVER) {
-                name = '待预约审片';
+                name = "待预约审片";
             } else if (this.orderInfo.statusFlag == OrderStatus.BOOKCHECK) {
-                name = '待审片';
+                name = "待审片";
             } else if (this.orderInfo.statusFlag == OrderStatus.CHECKOVER) {
-                name = '待预约取件';
+                name = "待预约取件";
             } else if (this.orderInfo.statusFlag == OrderStatus.BOOKACCESS) {
-                name = '待取件';
+                name = "待取件";
             } else if (this.orderInfo.statusFlag == OrderStatus.ACCESSOVER) {
-                name = '待评价';
+                name = "待评价";
             } else if (this.orderInfo.statusFlag == OrderStatus.FINISH) {
-                name = '已完成';
+                name = "已完成";
             } else if (this.orderInfo.statusFlag == OrderStatus.CANCEL) {
-                name = '取消';
+                name = "取消";
             }
 
             return name;
         },
         hasBookBtn() {
-            return this.statusName.indexOf('预约') != -1;
+            return this.statusName.indexOf("预约") != -1;
         },
         text() {
-            if (this.statusName == '待支付') {
-                return '订单还没有支付完成哦,赶快支付吧';
-            } else if (this.statusName == '待预约拍照') {
-                return '订单支付成功,请联系客服确定好档期后点击下方预约按钮进行拍照时间预约';
-            } else if (this.statusName == '待拍照') {
-                return '请按照预约日期到达店铺进行拍照,若因故无法按时拍摄,请事先联系客服进行时间调整,感谢您的配合';
-            } else if (this.statusName == '待预约选片') {
-                return '照片已拍摄完毕,请预约选片日期';
-            } else if (this.statusName == '待选片') {
-                return '请按照预约日期到达店铺进行选片,感谢您的配合';
-            } else if (this.statusName == '待预约审片') {
-                return '照片选片已完成,请预约审片时间';
-            } else if (this.statusName == '待审片') {
-                return '请按照预约日期到达店铺进行审片,感谢您的配合';
-            } else if (this.statusName == '待预约取件') {
-                return '图片已全部审片完毕,请预约取件时间';
-            } else if (this.statusName == '待取件') {
-                return '请按照预约日期到达店铺进行取件,感谢您的配合';
-            } else if (this.statusName == '待评价') {
-                return '本次交易已完成,请对我们的服务进行评价';
-            } else if (this.statusName == '已完成') {
-                return '本次交易已完成,感谢您的支持';
-            } else if (this.statusName == '取消') {
-                return '本次交易已取消,感谢您的支持';
+            if (this.statusName == "待支付") {
+                return "订单还没有支付完成哦,赶快支付吧";
+            } else if (this.statusName == "待预约拍照") {
+                return "订单支付成功,请联系客服确定好档期后点击下方预约按钮进行拍照时间预约";
+            } else if (this.statusName == "待拍照") {
+                return "请按照预约日期到达店铺进行拍照,若因故无法按时拍摄,请事先联系客服进行时间调整,感谢您的配合";
+            } else if (this.statusName == "待预约选片") {
+                return "照片已拍摄完毕,请预约选片日期";
+            } else if (this.statusName == "待选片") {
+                return "请按照预约日期到达店铺进行选片,感谢您的配合";
+            } else if (this.statusName == "待预约审片") {
+                return "照片选片已完成,请预约审片时间";
+            } else if (this.statusName == "待审片") {
+                return "请按照预约日期到达店铺进行审片,感谢您的配合";
+            } else if (this.statusName == "待预约取件") {
+                return "图片已全部审片完毕,请预约取件时间";
+            } else if (this.statusName == "待取件") {
+                return "请按照预约日期到达店铺进行取件,感谢您的配合";
+            } else if (this.statusName == "待评价") {
+                return "本次交易已完成,请对我们的服务进行评价";
+            } else if (this.statusName == "已完成") {
+                return "本次交易已完成,感谢您的支持";
+            } else if (this.statusName == "取消") {
+                return "本次交易已取消,感谢您的支持";
             } else {
-                return '';
+                return "";
             }
         },
         bookingTimeText() {
-            if (this.statusName == '待拍照') {
-                return '拍照时间:' + formatTime(this.orderInfo.bookPhotoTime);
-            } else if (this.statusName == '待选片') {
-                return '选片时间:' + formatTime(this.orderInfo.bookSelectTime);
-            } else if (this.statusName == '待审片') {
-                return '审片时间:' + formatTime(this.orderInfo.bookCheckTime);
-            } else if (this.statusName == '待取件') {
-                return '取件时间:' + formatTime(this.orderInfo.bookAccessTime);
+            if (this.statusName == "待拍照") {
+                return "拍照时间:" + formatTime(this.orderInfo.bookPhotoTime);
+            } else if (this.statusName == "待选片") {
+                return "选片时间:" + formatTime(this.orderInfo.bookSelectTime);
+            } else if (this.statusName == "待审片") {
+                return "审片时间:" + formatTime(this.orderInfo.bookCheckTime);
+            } else if (this.statusName == "待取件") {
+                return "取件时间:" + formatTime(this.orderInfo.bookAccessTime);
             } else {
-                return '';
+                return "";
             }
         },
         btnText() {
-            if (this.statusName == '待预约拍照') {
-                return '立即预约拍照';
-            } else if (this.statusName == '待预约选片') {
-                return '立即预约选片';
-            } else if (this.statusName == '待预约审片') {
-                return '立即预约审片';
-            } else if (this.statusName == '待预约取件') {
-                return '立即预约取件';
+            if (this.statusName == "待预约拍照") {
+                return "立即预约拍照";
+            } else if (this.statusName == "待预约选片") {
+                return "立即预约选片";
+            } else if (this.statusName == "待预约审片") {
+                return "立即预约审片";
+            } else if (this.statusName == "待预约取件") {
+                return "立即预约取件";
             } else {
-                return '';
+                return "";
             }
         },
         nowDate() {
@@ -292,16 +329,48 @@ export default {
             const month = date.getMonth() + 1;
             const day = date.getDate() + 1;
 
-            return year + '-' + month + '-' + day;
+            return year + "-" + month + "-" + day;
         },
+        repaireInfo() {
+            var list1 = [...this.orderInfo.orderRepairList];
+            var list2 = [...this.orderInfo.orderAlbumRepairList];
+            list1.filter(item => {
+                return item.statusFlag != 0;
+            });
+            list2.filter(item => {
+                return item.statusFlag != 0;
+            });
+
+            if (list1.length > list2.length) {
+                return {
+                    imageRepairId: list1[list1.length - 1].id,
+                    imageStatusFlag: list1[list1.length - 1].statusFlag
+                };
+            } else if (list2.length > list1.length) {
+                return {
+                    AlbumRepairId: list2[list2.length - 1].id,
+                    AlbumStatusFlag: list2[list2.length - 1].statusFlag
+                };
+            } else {
+                if (list1.length == 0) {
+                    return {};
+                } else {
+                    return {
+                        imageRepairId: list1[list1.length - 1].id,
+                        imageStatusFlag: list1[list1.length - 1].statusFlag,
+                        AlbumRepairId: list2[list2.length - 1].id,
+                        AlbumStatusFlag: list2[list2.length - 1].statusFlag
+                    };
+                }
+            }
+        }
     },
     onLoad(options) {
         console.log(options);
         this.orderId = options.orderId;
 
         this.$http
-            .get('/storeIntroduction/getOne', {
-            })
+            .get("/storeIntroduction/getOne", {})
             .then(res => {
                 if (res.success) {
                     this.address = res.data.address;
@@ -316,15 +385,15 @@ export default {
         if (options.userOrderId) {
             this.userOrderId = options.userOrderId;
             this.$http
-                .get('/userOrder/getOne', {
-                    id: options.userOrderId,
+                .get("/userOrder/getOne", {
+                    id: options.userOrderId
                 })
                 .then(res => {
                     if (res.success) {
                         this.userOrderidList = res.data.userOrderDetailList.map(
                             item => {
                                 return item.orderCode;
-                            },
+                            }
                         );
                     }
                 })
@@ -340,43 +409,61 @@ export default {
         this.getOrder();
     },
     methods: {
+        examinePhoto() {
+            var url="/pages/examinePhotos/examinePhotos?orderId=" + this.orderId;
+
+            if(this.repaireInfo.imageRepairId){
+                url=url+'&imageRepairId='+this.repaireInfo.imageRepairId
+            }
+            if(this.repaireInfo.albumRepairId){
+                  url=url+'&imageRepairId='+this.repaireInfo.albumRepairId
+            }
+            wx.navigateTo({
+                url:url
+            });
+        },
+        selectPhoto() {
+            wx.navigateTo({
+                url: "/pages/selectPhotos/selectPhotos?orderId=" + this.orderId
+            });
+        },
         goPay() {
             if (this.userOrderidList.length > 1) {
                 var ref = this;
                 wx.showModal({
-                    title: '该订单和其他订单同时下单',
+                    title: "该订单和其他订单同时下单",
                     content:
-                        ref.userOrderidList.join(',\r\n ') + '\r\n需要合并付款',
-                    confirmColor: '#00C5F2',
-                    confirmText: '合并付款',
+                        ref.userOrderidList.join(",\r\n ") + "\r\n需要合并付款",
+                    confirmColor: "#00C5F2",
+                    confirmText: "合并付款",
                     success(res) {
                         if (res.confirm) {
                             wx.navigateTo({
                                 url:
-                                    '/pages/submit/submit?orderId=' +
-                                    ref.userOrderId,
+                                    "/pages/submit/submit?orderId=" +
+                                    ref.userOrderId
                             });
                         } else if (res.cancel) {
                         }
-                    },
+                    }
                 });
             } else {
                 wx.navigateTo({
-                    url: '/pages/submit/submit?orderId=' + this.userOrderId,
+                    url: "/pages/submit/submit?orderId=" + this.userOrderId
                 });
             }
         },
         bookingTime() {
             wx.navigateTo({
                 url:
-                    '/pages/bookingTime/bookingTime?orderId=' +
-                    this.orderInfo.id,
+                    "/pages/bookingTime/bookingTime?orderId=" +
+                    this.orderInfo.id
             });
         },
         getOrder() {
             this.$http
-                .get('/userOrderDetail/getOne', {
-                    id: this.orderId,
+                .get("/userOrderDetail/getOne", {
+                    id: this.orderId
                 })
                 .then(res => {
                     if (res.success) {
@@ -385,70 +472,70 @@ export default {
                 });
         },
         takePhone() {
-            console.log('打电话');
+            console.log("打电话");
             wx.makePhoneCall({
-                phoneNumber: this.storeInfo.telephone, //仅为示例,并非真实的电话号码
+                phoneNumber: this.storeInfo.telephone //仅为示例,并非真实的电话号码
             });
         },
         bindDateChange(e) {
             var ref = this;
             wx.showModal({
-                title: '已选择:' + e.mp.detail.value,
-                content: ' 确定要预约当前日期吗?',
-                confirmColor: '#00C5F2',
+                title: "已选择:" + e.mp.detail.value,
+                content: " 确定要预约当前日期吗?",
+                confirmColor: "#00C5F2",
                 success(res) {
                     if (res.confirm) {
                         var data = {
-                            id: ref.orderInfo.id,
+                            id: ref.orderInfo.id
                         };
-                        if (ref.statusName == '待预约拍照') {
+                        if (ref.statusName == "待预约拍照") {
                             data.bookPhotoTime = Date.parse(
-                                new Date(e.mp.detail.value),
+                                new Date(e.mp.detail.value)
                             );
                             data.statusFlag = OrderStatus.BOOKPHOTO;
-                        } else if (ref.statusName == '待预约选片') {
+                        } else if (ref.statusName == "待预约选片") {
                             data.bookSelectTime = Date.parse(
-                                new Date(e.mp.detail.value),
+                                new Date(e.mp.detail.value)
                             );
                             data.statusFlag = OrderStatus.BOOKSELECT;
-                        } else if (ref.statusName == '待预约审片') {
+                        } else if (ref.statusName == "待预约审片") {
                             data.bookCheckTime = Date.parse(
-                                new Date(e.mp.detail.value),
+                                new Date(e.mp.detail.value)
                             );
                             data.statusFlag = OrderStatus.BOOKCHECK;
-                        } else if (ref.statusName == '待预约取件') {
+                        } else if (ref.statusName == "待预约取件") {
                             data.bookAccessTime = Date.parse(
-                                new Date(e.mp.detail.value),
+                                new Date(e.mp.detail.value)
                             );
                             data.statusFlag = OrderStatus.BOOKACCESS;
                         }
 
                         wx.showLoading({
-                            title: '加载中',
-                            mask: true,
+                            title: "加载中",
+                            mask: true
                         });
                         ref.$http
-                            .post('/userOrderDetail/update', data)
+                            .post("/userOrderDetail/update", data)
                             .then(res => {
                                 wx.hideLoading();
                                 if (res.success) {
                                     ref.getOrder();
                                     wx.showToast({
-                                        title: '预约成功',
-                                        icon: 'success',
-                                        duration: 1500,
+                                        title: "预约成功",
+                                        icon: "success",
+                                        duration: 1500
                                     });
                                 } else {
                                     wx.showToast({
                                         title: res.error,
-                                        icon: 'none',
-                                        duration: 1500,
+                                        icon: "none",
+                                        duration: 1500
                                     });
                                 }
                             });
                     } else if (res.cancel) {
                     }
-                },
+                }
             });
         },
         goLocation() {
@@ -457,19 +544,19 @@ export default {
                 longitude: Number(this.longitude),
                 name: this.storeName,
                 address: this.address,
-                scale: 14,
+                scale: 14
             });
         },
         goEvaluate() {
             wx.navigateTo({
-                url: '/pages/evaluate/evaluate?orderId=' + this.orderInfo.id,
+                url: "/pages/evaluate/evaluate?orderId=" + this.orderInfo.id
             });
-        },
+        }
     },
     components: {
         subOrder,
-        OrderStatus,
-    },
+        OrderStatus
+    }
 };
 </script>
 
@@ -652,6 +739,50 @@ export default {
 .fixedBottom {
     height: 56px;
 
+    .bottomBtnList {
+        position: fixed;
+        height: 56px;
+        width: 100%;
+        bottom: 0;
+        left: 0;
+        display: flex;
+        padding: 8px 15px;
+        box-sizing: border-box;
+        justify-content: space-between;
+        background-color: #f2f4f5;
+
+        button {
+            border-radius: 22px;
+            border: 1px solid rgba(0, 197, 242, 1);
+            width: 165px;
+            height: 40px;
+            font-size: 15px;
+            font-weight: bold;
+
+            &.primary {
+                background: rgba(0, 197, 242, 1);
+                color: #fff;
+
+                &:active {
+                    background: darken(rgba(0, 197, 242, 1), 10);
+                }
+            }
+
+            &.primaryDis {
+                background: darken(rgba(0, 197, 242, 1), 10);
+                color: #fff;
+            }
+
+            &.default {
+                background-color: #f2f4f5;
+                color: #00c5f2;
+                &:active {
+                    background: darken(#f2f4f5, 10);
+                }
+            }
+        }
+    }
+
     .submit {
         position: fixed;
         bottom: 10px;
@@ -685,6 +816,10 @@ export default {
             font-weight: bold;
             color: rgba(255, 255, 255, 1);
             line-height: 40px;
+            &.primaryDis {
+                background: darken(rgba(0, 197, 242, 1), 10);
+                color: #fff;
+            }
         }
 
         .picker {

+ 381 - 48
src/pages/selectPhotos/selectPhotos.vue

@@ -1,51 +1,207 @@
 <template>
-    <div class='container'>
+    <div class="container">
         <div class="top">
             <div class="banner">
-                <div class="banner-left">No.{{current+1}}/共{{imgList.length}}张</div>
-                <div class="banner-right">已选择:23张</div>
+                <div class="bannerItem">
+                    <div class="val">{{photoAmount}}/{{orderInfo.photoAmount}}</div>
+                    <div class="name">精修</div>
+                </div>
+                <div class="bannerItem">
+                    <div class="val">{{fandaAmount}}/{{orderInfo.fandaAmount}}</div>
+                    <div class="name">放大</div>
+                </div>
+                <div class="bannerItem">
+                    <div class="val">{{albumQuantity}}/{{orderInfo.albumQuantity}}</div>
+                    <div class="name">相册</div>
+                </div>
             </div>
         </div>
-        <swiper class="swiper" :current='current' @change='changeSwiper'>
-            <swiper-item v-for="(item,index) in imgList" :key="index" class="slide-image">
-                <img :src="item" background-size="contain" background-position="center center" @click="showImg(index)">
+        <swiper class="swiper" :current="current" @change="changeSwiper">
+            <swiper-item v-for="(item,index) in orderImage" :key="index" class="slide-image">
+                <img
+                    :src="item.originalImage"
+                    background-size="contain"
+                    background-position="center center"
+                    @click="showImg(index)"
+                />
             </swiper-item>
         </swiper>
-        <img class="left" v-if="current>0" @click="goPre" src="/static/images/icon_shangyiye_dis.png" alt="">
-        <img class="right" @click="goNext" src="/static/images/icon_xiayiye_dis.png" alt="">
+        <img
+            class="left"
+            v-if="current>0"
+            @click="goPre"
+            src="/static/images/icon_shangyiye_dis.png"
+            alt
+        />
+        <img class="right" @click="goNext" src="/static/images/icon_xiayiye_dis.png" alt />
         <div class="bottom">
-            <div class="message" :class="{notSet:!message}" @click="showMessage=true">
-                {{message}}
-            </div>
+            <div class="message" :class="{notSet:!message}" @click="showMessage=true">{{message}}</div>
 
-            <button class="btn" :class="{primary:isChoose}">{{isChoose?'已选择':'选择这张'}}</button>
+            <div class="btnList" :class="{submitList:canSubmit}">
+                <button
+                    :class="[isAlbum?'primary':'default']"
+                    @click="update('album',isAlbum?'N':'Y')"
+                >相册</button>
+                <button
+                    :class="[isFangda?'primary':'default']"
+                    @click="update('fangda',isFangda?'N':'Y')"
+                >放大</button>
+                <button
+                    :class="[isSelect?'primary':'default']"
+                    @click="update('selectFlag',isSelect?'N':'Y')"
+                >精修</button>
+                <button class="warning" v-if="canSubmit" @click="submit">提交选片</button>
+            </div>
         </div>
 
-        <messageContent :visible='showMessage' @close='showMessage=false' @submit='submit'></messageContent>
+        <messageContent
+            :visible="showMessage"
+            @close="showMessage=false"
+            @submit="submit"
+            :message="message"
+        ></messageContent>
     </div>
 </template>
 <script>
-import { mapState } from 'vuex';
-import messageContent from '../../components/Message';
+import { mapState } from "vuex";
+import messageContent from "../../components/Message";
+import { OrderStatus, OrderAlbumStatus } from "../../Constants";
 export default {
-    name: '',
+    name: "",
     data() {
         return {
             imgList: [
-                'https://bpic.588ku.com/illus_water_img/19/07/04/923c38ece95e492a51d77f6c595d4663.jpg',
-                'https://bpic.588ku.com/illus_water_img/19/06/05/cbe3f85497904ff30119a6dd4884024a.jpg',
-                'https://bpic.588ku.com/illus_water_img/19/06/14/de14f437789722334a0cc5ea02048ca7.jpg',
-                'https://bpic.588ku.com/illus_water_img/19/06/07/470ac937b435c696545ffb12e7bda675.jpg',
-                'https://bpic.588ku.com/illus_water_img/19/06/25/c64d4b4c8be8c62ff6806c449bcf7ec3.jpg',
+                "https://bpic.588ku.com/illus_water_img/19/07/04/923c38ece95e492a51d77f6c595d4663.jpg",
+                "https://bpic.588ku.com/illus_water_img/19/06/05/cbe3f85497904ff30119a6dd4884024a.jpg",
+                "https://bpic.588ku.com/illus_water_img/19/06/14/de14f437789722334a0cc5ea02048ca7.jpg",
+                "https://bpic.588ku.com/illus_water_img/19/06/07/470ac937b435c696545ffb12e7bda675.jpg",
+                "https://bpic.588ku.com/illus_water_img/19/06/25/c64d4b4c8be8c62ff6806c449bcf7ec3.jpg"
             ],
             current: 0,
-            message: '',
             isChoose: false,
             showMessage: false,
+            orderId: 0,
+            orderInfo: {},
+            orderImage: []
         };
     },
     computed: {
-        ...mapState(['userInfo']),
+        ...mapState(["userInfo"]),
+        isSelect() {
+            var val = false;
+            if (this.orderImage.length > 0) {
+                if (this.orderImage[this.current].selectFlag == "Y") {
+                    val = true;
+                }
+            }
+            return val;
+        },
+        isFangda() {
+            var val = false;
+            if (this.orderImage.length > 0) {
+                if (this.orderImage[this.current].fangda == "Y") {
+                    val = true;
+                }
+            }
+            return val;
+        },
+        isAlbum() {
+            var val = false;
+            if (this.orderImage.length > 0) {
+                if (this.orderImage[this.current].album == "Y") {
+                    val = true;
+                }
+            }
+            return val;
+        },
+        photoAmount() {
+            var num = 0;
+            var list = [...this.orderImage];
+            list.forEach(item => {
+                if (item.selectFlag == "Y") {
+                    num++;
+                }
+            });
+            return num;
+        },
+        fandaAmount() {
+            var num = 0;
+            var list = [...this.orderImage];
+            list.forEach(item => {
+                if (item.fangda == "Y") {
+                    num++;
+                }
+            });
+            return num;
+        },
+        albumQuantity() {
+            var num = 0;
+            var list = [...this.orderImage];
+            list.forEach(item => {
+                if (item.album == "Y") {
+                    num++;
+                }
+            });
+            return num;
+        },
+        message() {
+            var val = "";
+            if (this.orderImage.length > 0) {
+                val = this.orderImage[this.current].remark || "";
+            }
+            return val;
+        },
+        canFangda() {
+            if (this.fandaAmount < this.orderInfo.fandaAmount) {
+                return true;
+            } else {
+                return false;
+            }
+        },
+        canAlbum() {
+            if (this.albumQuantity < this.orderInfo.albumQuantity) {
+                return true;
+            } else {
+                return false;
+            }
+        },
+        canSelect() {
+            if (this.photoAmount < this.orderInfo.photoAmount) {
+                return true;
+            } else {
+                return false;
+            }
+        },
+        canSubmit() {
+            if (!this.canFangda && !this.canSelect) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+    },
+    onLoad(options) {
+        if (options.orderId) {
+            this.orderId = options.orderId;
+        }
+        this.$http
+            .get("/userOrderDetail/getOne", {
+                id: this.orderId
+            })
+            .then(res => {
+                if (res.success) {
+                    this.orderInfo = res.data;
+                }
+            });
+        this.$http
+            .get("/orderImage/all", {
+                orderId: this.orderId
+            })
+            .then(res => {
+                if (res.success) {
+                    this.orderImage = res.data;
+                }
+            });
     },
     methods: {
         goPre() {
@@ -62,24 +218,144 @@ export default {
         },
         submit(text) {
             console.log(text);
+            this.update("remark", text);
             this.showMessage = false;
         },
         showImg(index) {
             wx.previewImage({
-                current: index, // 当前显示图片的http链接
-                urls: this.imgList, // 需要预览的图片http链接列表
+                current: this.orderImage[index].originalImage, // 当前显示图片的http链接
+                urls: [this.orderImage[index].originalImage] // 需要预览的图片http链接列表
+            });
+        },
+        update(key, value) {
+            var data = {
+                id: this.orderImage[this.current].id
+            };
+
+            if (key == "fangda") {
+                if (value == "Y") {
+                    if (!this.canFangda) {
+                        wx.showToast({
+                            title: "放大数量已满",
+                            icon: "none",
+                            duration: 1500
+                        });
+                        return;
+                    }
+                    if (!this.isSelect && !this.canSelect) {
+                        wx.showToast({
+                            title: "精修数量已满,请在精修当中选择放大",
+                            icon: "none",
+                            duration: 1500
+                        });
+                        return;
+                    }
+                    data.fangda = "Y";
+                    data.selectFlag = "Y";
+                } else {
+                    data.fangda = "N";
+                }
+            } else if (key == "album") {
+                if (value == "Y") {
+                    if (!this.canAlbum) {
+                        wx.showToast({
+                            title: "相册数量已满",
+                            icon: "none",
+                            duration: 1500
+                        });
+                        return;
+                    }
+                    if (!this.isSelect && !this.canSelect) {
+                        wx.showToast({
+                            title: "精修数量已满,请在精修当中选择相册",
+                            icon: "none",
+                            duration: 1500
+                        });
+                        return;
+                    }
+                    data.album = "Y";
+                    data.selectFlag = "Y";
+                } else {
+                    data.album = "N";
+                }
+            } else if (key == "selectFlag") {
+                if (value == "Y") {
+                    if (!this.canSelect) {
+                        wx.showToast({
+                            title: "精修数量已满",
+                            icon: "none",
+                            duration: 1500
+                        });
+                        return;
+                    }
+                    data.selectFlag = "Y";
+                } else {
+                    data.album = "N";
+                    data.fangda = "N";
+                    data.selectFlag = "N";
+                }
+            } else if (key == "remark") {
+                data.remark = value;
+            }
+            this.$http.post("/orderImage/update", data).then(res => {
+                if (res.success) {
+                    this.$http
+                        .get("/orderImage/getOne", {
+                            id: this.orderImage[this.current].id
+                        })
+                        .then(res => {
+                            if (res.success) {
+                                this.$set(
+                                    this.orderImage,
+                                    this.current,
+                                    res.data
+                                );
+                            }
+                        });
+                }
             });
         },
+        submit() {
+            var ref=this;
+            wx.showModal({
+                title: "提示",
+                content: "确定提交选片吗?",
+                success(res) {
+                    if (res.confirm) {
+                        ref.$http
+                            .post("/userOrderDetail/update", {
+                                id: ref.orderId,
+                                statusFlag: OrderStatus.SELECTOVER,
+                                albumStatus: OrderAlbumStatus.SELECTOVER
+                            })
+                            .then(res => {
+                                if (res.success) {
+                                    wx.showToast({
+                                        title: "选片成功",
+                                        icon: "success",
+                                        duration: 1500
+                                    });
+                                    setTimeout(()=>{
+                                        wx.navigateBack();
+                                    },1500)
+                                }
+                            });
+                    } else if (res.cancel) {
+                        console.log("用户点击取消");
+                    }
+                }
+            });
+        }
     },
     components: {
-        messageContent,
-    },
+        messageContent
+    }
 };
 </script>
 <style lang='less' scoped>
 .top {
-    min-height: 80px;
-    height: 80px;
+    min-height: 100px;
+    height: 100px;
 }
 .bottom {
     min-height: 148px;
@@ -127,25 +403,30 @@ export default {
 }
 
 .banner {
-    height: 50px;
-    background: rgba(255, 255, 255, 1);
-    box-shadow: 0px 6px 16px 0px rgba(0, 0, 0, 0.08);
-    border-radius: 36px;
-    margin: 10px 15px;
+    height: 80px;
+    background: rgba(242, 244, 245, 1);
+    border-radius: 8px;
     display: flex;
-    justify-content: space-around;
-    align-items: center;
-    .banner-left {
-        font-size: 14px;
-        font-weight: bold;
-        color: rgba(0, 0, 0, 1);
-        line-height: 20px;
-    }
-    .banner-right {
-        font-size: 14px;
-        font-weight: bold;
-        color: rgba(0, 197, 242, 1);
-        line-height: 20px;
+    margin: 10px 15px;
+
+    .bannerItem {
+        width: 33%;
+        display: flex;
+        align-items: center;
+        flex-direction: column;
+        justify-content: center;
+        .val {
+            font-size: 18px;
+            font-weight: bold;
+            color: rgba(0, 0, 0, 1);
+            line-height: 21px;
+        }
+        .name {
+            font-size: 13px;
+            color: rgba(153, 153, 153, 1);
+            line-height: 18px;
+            margin-top: 5px;
+        }
     }
 }
 
@@ -161,7 +442,7 @@ export default {
 
     &.notSet {
         &::before {
-            content: '输入备注内容';
+            content: "输入备注内容";
             color: rgba(170, 172, 173, 1);
         }
     }
@@ -188,4 +469,56 @@ export default {
         color: #fff;
     }
 }
+
+.btnList {
+    display: flex;
+    padding: 0 15px;
+    justify-content: space-between;
+    align-items: center;
+    margin: 35px 0 0;
+
+    button {
+        width: 100px;
+        height: 40px;
+        font-size: 15px;
+        font-weight: bold;
+        border: 1px solid #00c5f2;
+        border-radius: 40px;
+
+        &.primary {
+            background-color: #00c5f2;
+            color: #fff;
+            &:active {
+                background-color: darken(#00c5f2, 10);
+            }
+        }
+
+        &.default {
+            background-color: #fff;
+            color: #00c5f2;
+            &:active {
+                background-color: darken(#fff, 10);
+            }
+        }
+    }
+
+    &.submitList {
+        button {
+            width: 80px;
+            height: 30px;
+            font-size: 12px;
+            line-height: 30px;
+
+            &.warning {
+                border: 1px solid #ff8f00;
+                background-color: #ff8f00;
+                color: #fff;
+
+                &:active {
+                    background-color: darken(#ff8f00, 10);
+                }
+            }
+        }
+    }
+}
 </style>

+ 157 - 37
src/pages/shoppingCart/shoppingCart.vue

@@ -1,14 +1,35 @@
 <template>
-    <div class="main" :style="{ background:isFinish&&cartList.length!=0?'linear-gradient(#00c5f2 232rpx, #f2f4f5 232rpx, #f2f4f5)':'#f2f4f5' }">
+    <div
+        class="main"
+        :style="{ background:isFinish&&cartList.length!=0?'linear-gradient(#00c5f2 232rpx, #f2f4f5 232rpx, #f2f4f5)':'#f2f4f5' }"
+    >
         <div class="config">
             <span>共{{chooseList.length}}件商品</span>
             <span @click="isConfig=!isConfig">{{isConfig?'结算':'管理'}}</span>
         </div>
 
+        <div v-if="nowShowActive.id&&totalMoney" class="manjian" @click="goMore">
+            <img src="/static/images/icon_manjian.png" class="icon" alt />
+            <div class="val">
+                <span>满{{nowShowActive.maxValue}}元减{{nowShowActive.minValue}}元</span>
+                <span v-if="lessMoney">,还差{{lessMoney}}</span>
+            </div>
+
+            <span v-if="lessMoney>0">去凑单</span>
+            <img src="/static/images/icon_inter_huang.png" class="more" v-if="lessMoney>0" alt />
+        </div>
+
         <div class="cartList">
-            <shoppingCart v-for="(item,index) in cartList" @choose='choose' :chooseList='chooseList' :info="item" :index='index' :key="index" @updateAmount='updateAmount'></shoppingCart>
-            <view class="weui-loadmore" v-if="isFinish">
-            </view>
+            <shoppingCart
+                v-for="(item,index) in cartList"
+                @choose="choose"
+                :chooseList="chooseList"
+                :info="item"
+                :index="index"
+                :key="index"
+                @updateAmount="updateAmount"
+            ></shoppingCart>
+            <view class="weui-loadmore" v-if="isFinish"></view>
             <view class="weui-loadmore" v-else>
                 <view class="weui-loading"></view>
                 <view class="weui-loadmore__tips">正在加载</view>
@@ -16,7 +37,7 @@
         </div>
 
         <div class="nothing" v-if="isFinish&&cartList.length==0">
-            <img src="/static/images/kong_icon_gouwuche.png" alt="">
+            <img src="/static/images/kong_icon_gouwuche.png" alt />
             <div class="title">购物车还没东西哦</div>
             <div class="sub">还没找到自己喜欢的东西吗</div>
             <button @click="goHome">去逛逛</button>
@@ -24,8 +45,18 @@
 
         <div class="fixedBottom" v-if="!isConfig">
             <div @click="ChangeChoose">
-                <img v-if="isChooseAll" src="/static/images/gouwuche_icon_xuanzhong.png" class="leftIcon" alt="">
-                <img v-else src="/static/images/gouwuche_icon_weixuanzhong.png" class="leftIcon" alt="">
+                <img
+                    v-if="isChooseAll"
+                    src="/static/images/gouwuche_icon_xuanzhong.png"
+                    class="leftIcon"
+                    alt
+                />
+                <img
+                    v-else
+                    src="/static/images/gouwuche_icon_weixuanzhong.png"
+                    class="leftIcon"
+                    alt
+                />
             </div>
             <span>全选</span>
             <span class="zhan"></span>
@@ -38,8 +69,18 @@
 
         <div class="fixedBottom" v-else>
             <div @click="ChangeChoose">
-                <img v-if="isChooseAll" src="/static/images/gouwuche_icon_xuanzhong.png" class="leftIcon" alt="">
-                <img v-else src="/static/images/gouwuche_icon_weixuanzhong.png" class="leftIcon" alt="">
+                <img
+                    v-if="isChooseAll"
+                    src="/static/images/gouwuche_icon_xuanzhong.png"
+                    class="leftIcon"
+                    alt
+                />
+                <img
+                    v-else
+                    src="/static/images/gouwuche_icon_weixuanzhong.png"
+                    class="leftIcon"
+                    alt
+                />
             </div>
             <span style="flex-grow:1">全选</span>
 
@@ -49,9 +90,9 @@
 </template>
 
 <script>
-import { mapState } from 'vuex';
-import shoppingCart from '../../components/ShoppingCart';
-import calc from '../../calc';
+import { mapState } from "vuex";
+import shoppingCart from "../../components/ShoppingCart";
+import calc from "../../calc";
 export default {
     data() {
         return {
@@ -61,10 +102,11 @@ export default {
             cartList: [],
             chooseList: [],
             isConfig: false,
+            activityList: []
         };
     },
     computed: {
-        ...mapState(['userInfo', 'storeInfo']),
+        ...mapState(["userInfo", "storeInfo"]),
         isChooseAll() {
             var result = false;
             if (
@@ -94,6 +136,31 @@ export default {
             });
             return money;
         },
+        nowShowActive() {
+            var info = {};
+            var activeList = [...this.activityList];
+            for (var i = 0; i < activeList.length; i++) {
+                if (this.totalMoney < Number(activeList[i].maxValue)) {
+                    info = activeList[i];
+                    break;
+                }
+
+                if (i == activeList.length - 1) {
+                    info = activeList[i];
+                }
+            }
+            return info;
+        },
+        lessMoney() {
+            var money = 0;
+            if (this.nowShowActive.id) {
+                money = Number(this.nowShowActive.maxValue) - this.totalMoney;
+                if (money < 0) {
+                    money = 0;
+                }
+            }
+            return money;
+        }
     },
     onShow() {
         this.isFinish = false;
@@ -102,6 +169,7 @@ export default {
         wx.setNavigationBarTitle({ title: this.storeInfo.storeName });
         this.currentPage = 1;
         this.getList();
+        this.getActivityList();
     },
     onReachBottom() {
         if (this.flag) {
@@ -110,6 +178,22 @@ export default {
         }
     },
     methods: {
+        goMore() {
+            if (this.lessMoney > 0) {
+                this.goHome();
+            }
+        },
+        getActivityList() {
+            this.$http
+                .get("/activityInfo/getUsedManJian", {
+                    typeId: 6
+                })
+                .then(res => {
+                    if (res.data) {
+                        this.activityList = res.data;
+                    }
+                });
+        },
         getTotal(info) {
             var money = 0;
             if (info.typeFlag == 0) {
@@ -121,7 +205,7 @@ export default {
         },
         goHome() {
             wx.switchTab({
-                url: '/pages/home/home',
+                url: "/pages/home/home"
             });
         },
         getList() {
@@ -129,13 +213,13 @@ export default {
             if (this.currentPage == 1) {
                 this.cartList = [];
                 wx.pageScrollTo({
-                    scrollTop: 0,
+                    scrollTop: 0
                 });
             }
             this.$http
-                .get('/shoppingCart/page', {
+                .get("/shoppingCart/page", {
                     userId: this.userInfo.id,
-                    currentPage: this.currentPage,
+                    currentPage: this.currentPage
                 })
                 .then(res => {
                     if (res.success) {
@@ -180,9 +264,9 @@ export default {
         delList(index) {
             if (index >= this.chooseList.length) {
                 wx.showToast({
-                    title: '删除成功',
-                    icon: 'success',
-                    duration: 1500,
+                    title: "删除成功",
+                    icon: "success",
+                    duration: 1500
                 });
                 this.currentPage = 1;
                 this.getList();
@@ -190,8 +274,8 @@ export default {
                 return;
             }
             this.$http
-                .post('/shoppingCart/del', {
-                    id: this.chooseList[index],
+                .post("/shoppingCart/del", {
+                    id: this.chooseList[index]
                 })
                 .then(res => {
                     if (res.success) {
@@ -200,8 +284,8 @@ export default {
                         wx.hideLoading();
                         wx.showToast({
                             title: res.error,
-                            icon: 'none',
-                            duration: 1500,
+                            icon: "none",
+                            duration: 1500
                         });
                     }
                 });
@@ -209,37 +293,37 @@ export default {
         submit() {
             if (this.chooseList.length == 0) {
                 wx.showToast({
-                    title: '请选择商品',
-                    icon: 'none',
-                    duration: 1500,
+                    title: "请选择商品",
+                    icon: "none",
+                    duration: 1500
                 });
                 return;
             }
 
             wx.navigateTo({
                 url:
-                    '/pages/submit/submit?submitPage=shoppingCart&chooseList=' +
-                    this.chooseList.join(','),
+                    "/pages/submit/submit?submitPage=shoppingCart&chooseList=" +
+                    this.chooseList.join(",")
             });
         },
         del() {
             if (this.chooseList.length == 0) {
                 wx.showToast({
-                    title: '请选择商品',
-                    icon: 'none',
-                    duration: 1500,
+                    title: "请选择商品",
+                    icon: "none",
+                    duration: 1500
                 });
                 return;
             }
             wx.showLoading({
-                title: '加载中',
+                title: "加载中"
             });
             this.delList(0);
-        },
+        }
     },
     components: {
-        shoppingCart,
-    },
+        shoppingCart
+    }
 };
 </script>
 
@@ -299,7 +383,7 @@ export default {
         font-weight: bold;
         color: rgba(255, 59, 48, 1);
         &::before {
-            content: '¥';
+            content: "¥";
             font-size: 32rpx;
         }
     }
@@ -333,4 +417,40 @@ export default {
         }
     }
 }
+
+.manjian {
+    height: 38px;
+    background: rgba(255, 255, 255, 1);
+    border-radius: 8px;
+    display: flex;
+    align-items: center;
+    margin: 0 15px;
+    padding: 0 0 0 12px;
+
+    .icon {
+        width: 28px;
+        height: 16px;
+    }
+
+    .more {
+        width: 24px;
+        height: 24px;
+    }
+
+    span {
+        font-size: 12px;
+        color: rgba(0, 197, 242, 1);
+    }
+    .val {
+        margin-left: 5px;
+        flex-grow: 1;
+        display: flex;
+        align-items: center;
+        span {
+            font-size: 12px;
+            font-weight: bold;
+            color: rgba(51, 51, 51, 1);
+        }
+    }
+}
 </style>

+ 233 - 91
src/pages/submit/submit.vue

@@ -1,54 +1,86 @@
 <template>
     <div class="container">
-        <subOrder :list='userOrderDetailList' :productMoney='productMoney' :type="pageType" @changeMessage='changeMessage'></subOrder>
+        <subOrder
+            :list="userOrderDetailList"
+            :productMoney="productMoney"
+            :type="pageType"
+            @changeMessage="changeMessage"
+        ></subOrder>
 
         <div class="card">
             <div class="cardItem">
                 <div class="name">支付方式</div>
                 <!-- <div class="val">微信支付</div> -->
-                <div class="val">余额支付<small>(测试阶段)</small></div>
+                <div class="val">
+                    余额支付
+                    <small>(测试阶段)</small>
+                </div>
             </div>
-        </div>
+            <div v-if="pageType == 'submit'">
+                <div class="cardItem">
+                    <div class="name">优惠券</div>
+                    <!-- <div class="val">微信支付</div> -->
+                    <div class="val" @click="goUse">
+                        <span class="youhui" v-if="couponId">-{{couponMoney}}</span>
+                        <span class="canUse" v-else-if="canUseLength>0">{{canUseLength}}张优惠券可用</span>
+                        <span class="cantUse" v-else>无可用优惠券</span>
+                        <img class="more" src="/static/images/icon_inter.png" alt />
+                    </div>
+                </div>
 
-        <div class="tip">
-            tips:测试阶段:支付用余额支付先行测试,余额默认无穷
+                <div class="cardItem" v-if="activeMoney">
+                    <div class="name">
+                        <img src="/static/images/icon_manjian.png" class='logo' alt="">
+                        <span>店铺满减优惠</span>
+                    </div>
+                    <!-- <div class="val">微信支付</div> -->
+                    <div class="val">
+                        <span class="youhui">-{{activeMoney}}</span>
+                        <div style="width:24px"></div>
+                    </div>
+                </div>
+            </div>
         </div>
 
+        <div class="tip">tips:测试阶段:支付用余额支付先行测试,余额默认无穷</div>
+
         <div class="fixBottom">
             <span>总价:</span>
-            <span class="price">{{totalMoney}}</span>
+            <span class="price">{{showMoney}}</span>
             <button @click="pay">确认支付</button>
         </div>
     </div>
 </template>
 
 <script>
-import { mapState } from 'vuex';
-import subOrder from '../../components/SubOrder';
-import calc from '../../calc';
+import { mapState } from "vuex";
+import subOrder from "../../components/SubOrder";
+import calc from "../../calc";
 export default {
     data() {
         return {
-            pageType: 'submit',
+            pageType: "submit",
             productIdList: [],
             amountList: [],
             typeFlagList: [],
-            submitPage: 'product',
+            submitPage: "product",
             productList: [],
-            message: '',
+            message: "",
             orderInfo: {},
             shoppCartIdList: [],
             shoppCartInfoList: [],
             serviceList: [],
             serviceIdList: [],
             typeFlag: 0,
+            couponList: [],
+            activityList: []
         };
     },
     computed: {
-        ...mapState(['userInfo']),
+        ...mapState(["userInfo", "couponId"]),
         productMoney() {
             var money = 0;
-            if (this.pageType == 'submit') {
+            if (this.pageType == "submit") {
                 var list = [...this.userOrderDetailList];
 
                 list.forEach(item => {
@@ -59,15 +91,35 @@ export default {
             return money;
         },
         totalMoney() {
-            if (this.pageType == 'submit') {
-                return this.productMoney;
+            return this.productMoney;
+        },
+        nowShowActive() {
+            var info = {};
+            var activeList = [...this.activityList];
+            for (var i = 0; i < activeList.length; i++) {
+                if (this.totalMoney >= Number(activeList[i].maxValue)) {
+                    info = activeList[i];
+                }
+            }
+            return info;
+        },
+        activeMoney() {
+            var money = "";
+            if (this.nowShowActive.id) {
+                money = Number(this.nowShowActive.minValue);
+            }
+            return money;
+        },
+        showMoney() {
+            if (this.pageType == "submit") {
+                return this.totalMoney - this.couponMoney - this.activeMoney;
             } else {
                 return this.orderInfo.dealPrice;
             }
         },
         userOrderDetailList() {
             var list = [];
-            if (this.submitPage == 'product' && this.productList.length > 0) {
+            if (this.submitPage == "product" && this.productList.length > 0) {
                 list = [
                     {
                         productInfo: this.productList[0],
@@ -75,16 +127,16 @@ export default {
                         quantity: this.amountList[0],
                         typeFlag: this.typeFlagList[0],
                         message: this.message,
-                        useType: '到店消费',
+                        useType: "到店消费",
                         productMoney: this.getProductMoney(
                             this.productList[0],
                             this.amountList[0],
-                            this.typeFlagList[0],
-                        ),
-                    },
+                            this.typeFlagList[0]
+                        )
+                    }
                 ];
             } else if (
-                this.submitPage == 'shoppingCart' &&
+                this.submitPage == "shoppingCart" &&
                 this.shoppCartInfoList.length > 0
             ) {
                 var allList = [...this.shoppCartInfoList];
@@ -95,47 +147,44 @@ export default {
                         quantity: item.amount,
                         typeFlag: item.typeFlag,
                         message: this.message,
-                        useType: '到店消费',
+                        useType: "到店消费",
                         productMoney: this.getProductMoney(
                             item.productInfo,
                             item.amount,
-                            item.typeFlag,
-                        ),
+                            item.typeFlag
+                        )
                     });
                 });
-            } else if (this.pageType == 'pay' && this.orderInfo.id) {
+            } else if (this.pageType == "pay" && this.orderInfo.id) {
                 list = [...this.orderInfo.userOrderDetailList];
-            } else if (this.submitPage == 'customize') {
+            } else if (this.submitPage == "customize") {
                 var orderServiceList = [...this.serviceList];
                 orderServiceList = orderServiceList.map(item => {
                     return {
                         serviceId: item.id,
                         amount: 1,
-                        message: this.message,
+                        message: this.message
                     };
                 });
                 list = [
                     {
                         productInfo: {
-                            title: '私人定制套餐',
+                            title: "私人定制套餐",
                             typeFlag: this.typeFlag,
                             price: this.totalCustomizePrice,
-                            downPayment: calc.Mul(
-                                this.totalCustomizePrice,
-                                0.3,
-                            ),
+                            downPayment: calc.Mul(this.totalCustomizePrice, 0.3)
                         },
                         productMoney:
                             this.typeFlag == 0
                                 ? this.totalCustomizePrice
                                 : calc.Mul(this.totalCustomizePrice, 0.3),
-                        useType: '私人定制',
-                        tailorFlag: 'Y',
+                        useType: "私人定制",
+                        tailorFlag: "Y",
                         quantity: 1,
                         typeFlag: this.typeFlag,
                         message: this.message,
-                        orderServiceList: orderServiceList,
-                    },
+                        orderServiceList: orderServiceList
+                    }
                 ];
             }
 
@@ -150,28 +199,50 @@ export default {
 
             return money;
         },
+        canUseLength() {
+            return this.couponList.length;
+        },
+        couponInfo() {
+            var info = {};
+            if (this.couponId) {
+                var couponList = [...this.couponList];
+                couponList.forEach(item => {
+                    if (item.id == this.couponId) {
+                        info = item;
+                    }
+                });
+            }
+            return info;
+        },
+        couponMoney() {
+            var money = 0;
+            if (this.couponInfo.id) {
+                money = this.couponInfo.couponInfo.discountMoney;
+            }
+            return money;
+        }
     },
     onLoad(options) {
-        this.message = '';
+        this.message = "";
         console.log(options);
         this.refreash();
         if (options.submitPage) {
             this.submitPage = options.submitPage;
-            if (this.submitPage == 'product') {
-                this.productIdList = options.productId.split(',');
-                this.amountList = options.amount.split(',');
-                this.typeFlagList = options.typeFlag.split(',');
+            if (this.submitPage == "product") {
+                this.productIdList = options.productId.split(",");
+                this.amountList = options.amount.split(",");
+                this.typeFlagList = options.typeFlag.split(",");
                 this.getProduct();
-            } else if (this.submitPage == 'customize') {
+            } else if (this.submitPage == "customize") {
                 this.typeFlag = options.typeFlag;
-                this.serviceIdList = options.serviceList.split(',');
-                var serviceIdList = options.serviceList.split(',');
+                this.serviceIdList = options.serviceList.split(",");
+                var serviceIdList = options.serviceList.split(",");
                 serviceIdList.forEach(item => {
                     this.getServiceList(item);
                 });
             } else {
-                this.shoppCartIdList = options.chooseList.split(',');
-                var shoppCartIdList = options.chooseList.split(',');
+                this.shoppCartIdList = options.chooseList.split(",");
+                var shoppCartIdList = options.chooseList.split(",");
                 shoppCartIdList.forEach(item => {
                     this.getShoopingCart(item);
                 });
@@ -180,22 +251,56 @@ export default {
 
         if (options.orderId) {
             this.orderId = options.orderId;
-            this.pageType = 'pay';
+            this.pageType = "pay";
             this.getOrder();
             wx.setNavigationBarTitle({
-                title: '支付订单',
+                title: "支付订单"
             });
         } else {
             wx.setNavigationBarTitle({
-                title: '确认订单',
+                title: "确认订单"
             });
         }
+
+        setTimeout(() => {
+            if (this.pageType == "submit") {
+                this.$http
+                    .get("/userCoupon/best", {
+                        userId: this.userInfo.id,
+                        price: this.totalMoney
+                    })
+                    .then(res => {
+                        if (res.success) {
+                            this.couponList = res.data;
+                        }
+                    });
+            } else {
+                this.couponList = [];
+            }
+        }, 1000);
+        this.getActivityList();
     },
     methods: {
+        getActivityList() {
+            this.$http
+                .get("/activityInfo/getUsedManJian", {
+                    typeId: 6
+                })
+                .then(res => {
+                    if (res.data) {
+                        this.activityList = res.data;
+                    }
+                });
+        },
+        goUse() {
+            wx.navigateTo({
+                url: "/pages/useCoupon/useCoupon?money=" + this.totalMoney
+            });
+        },
         getServiceList(id) {
             this.$http
-                .get('/storeService/getOne', {
-                    id: id,
+                .get("/storeService/getOne", {
+                    id: id
                 })
                 .then(res => {
                     if (res.success) {
@@ -208,8 +313,8 @@ export default {
         },
         getShoopingCart(id) {
             this.$http
-                .get('/shoppingCart/getOne', {
-                    id: id,
+                .get("/shoppingCart/getOne", {
+                    id: id
                 })
                 .then(res => {
                     if (res.success) {
@@ -221,13 +326,13 @@ export default {
                 });
         },
         refreash() {
-            this.pageType = 'submit';
+            this.pageType = "submit";
             this.productIdList = [];
             this.amountList = [];
             this.typeFlagList = [];
-            this.submitPage = 'product';
+            this.submitPage = "product";
             this.productList = [];
-            this.message = '';
+            this.message = "";
             this.orderInfo = {};
             this.shoppCartIdList = [];
             this.shoppCartInfoList = [];
@@ -245,7 +350,7 @@ export default {
                 } else {
                     money = calc.Mul(
                         Number(info.downPayment),
-                        Number(quantity),
+                        Number(quantity)
                     );
                 }
             }
@@ -254,7 +359,7 @@ export default {
         },
         getOrder() {
             this.$http
-                .get('/userOrder/getOne', { id: this.orderId })
+                .get("/userOrder/getOne", { id: this.orderId })
                 .then(res => {
                     if (res.success) {
                         this.orderInfo = res.data;
@@ -267,7 +372,7 @@ export default {
         getProduct() {
             this.productList = [];
             this.$http
-                .get('/productInfo/getOne', { id: this.productIdList[0] })
+                .get("/productInfo/getOne", { id: this.productIdList[0] })
                 .then(res => {
                     if (res.success) {
                         this.productList.push(res.data);
@@ -282,8 +387,8 @@ export default {
                 return;
             }
             this.$http
-                .post('/shoppingCart/del', {
-                    id: this.shoppCartIdList[index],
+                .post("/shoppingCart/del", {
+                    id: this.shoppCartIdList[index]
                 })
                 .then(res => {
                     if (res.success) {
@@ -297,12 +402,12 @@ export default {
                 var data = {
                     userId: this.userInfo.id,
                     // storeId: this.userOrderDetailList[0].productInfo.storeId,
-                    userOrderDetailList: [...this.userOrderDetailList],
+                    userOrderDetailList: [...this.userOrderDetailList]
                 };
                 console.log(data);
 
-                if (this.submitPage == 'customize') {
-                    data.tailorFlag = 'Y';
+                if (this.submitPage == "customize") {
+                    data.tailorFlag = "Y";
                 }
 
                 data.userOrderDetailList.forEach(item => {
@@ -310,14 +415,19 @@ export default {
                     delete item.productMoney;
                 });
                 wx.showLoading({
-                    title: '加载中',
-                    mask: true,
+                    title: "加载中",
+                    mask: true
                 });
-                if (this.submitPage == 'shoppingCart') {
+                if (this.submitPage == "shoppingCart") {
                     this.delCart(0);
                 }
+
+                if(this.couponId){
+                    data.userCouponId=this.couponId
+                }
+
                 this.$http
-                    .postJ('/userOrder/submit', data)
+                    .postJ("/userOrder/submit", data)
                     .then(res => {
                         wx.hideLoading();
                         if (res.success) {
@@ -325,8 +435,8 @@ export default {
                         } else {
                             wx.showToast({
                                 title: res.error,
-                                icon: 'none',
-                                duration: 1500,
+                                icon: "none",
+                                duration: 1500
                             });
                         }
                     })
@@ -337,37 +447,36 @@ export default {
         },
         pay() {
             console.log(this.pageType);
-            if (this.pageType == 'submit') {
-                this.submitOrder().then(id => {
-                    console.log(id);
-                    this.orderId = id;
-                    this.payMoney();
+            if (this.pageType == "submit") {
+                this.submitOrder().then(info => {
+                    this.orderId = info.id;
+                    this.payMoney(info);
                 });
             } else {
-                this.payMoney();
-                this.$store.commit('updateChangeOrder', true);
+                this.payMoney(this.orderInfo);
+                this.$store.commit("updateChangeOrder", true);
             }
         },
-        payMoney() {
+        payMoney(info) {
             //测试阶段先用余额支付
             wx.showLoading({
-                title: '加载中',
-                mask: true,
+                title: "加载中",
+                mask: true
             });
             this.$http
-                .post('userOrder/pay', {
+                .post("userOrder/pay", {
                     orderId: this.orderId,
-                    coin: this.totalMoney,
+                    coin: info.dealPrice,
                     point: 0,
-                    cash: 0,
+                    cash: 0
                 })
                 .then(res => {
                     wx.hideLoading();
                     if (res.success) {
                         wx.redirectTo({
                             url:
-                                '/pages/successPage/successPage?pageType=paySuccess&orderId=' +
-                                this.orderId,
+                                "/pages/successPage/successPage?pageType=paySuccess&orderId=" +
+                                this.orderId
                         });
                         // wx.showToast({
                         //     title: '支付成功',
@@ -380,16 +489,16 @@ export default {
                     } else {
                         wx.showToast({
                             title: res.error,
-                            icon: 'none',
-                            duration: 1500,
+                            icon: "none",
+                            duration: 1500
                         });
                     }
                 });
-        },
+        }
     },
     components: {
-        subOrder,
-    },
+        subOrder
+    }
 };
 </script>
 
@@ -417,6 +526,14 @@ export default {
             font-size: 13px;
             color: rgba(56, 56, 56, 1);
             line-height: 18px;
+            display: flex;
+            align-items: center;
+
+            .logo{
+                width: 28px;
+                height: 16px;
+                margin-right: 6px;
+            }
         }
 
         .val {
@@ -425,10 +542,30 @@ export default {
             font-weight: bold;
             color: rgba(0, 0, 0, 1);
             line-height: 20px;
+            display: flex;
+            align-items: center;
             small {
                 font-size: 12px;
                 color: #999;
             }
+
+            .canUse {
+                font-size: 12px;
+                color: rgba(255, 59, 48, 1);
+                line-height: 17px;
+            }
+            .cantUse {
+                font-size: 12px;
+                color: #aaacad;
+                line-height: 17px;
+            }
+
+            .youhui {
+                font-size: 14px;
+                font-weight: bold;
+                color: rgba(255, 59, 48, 1);
+                line-height: 20px;
+            }
         }
     }
 }
@@ -481,4 +618,9 @@ export default {
     padding: 30px 0;
     font-size: 12px;
 }
+
+.more {
+    width: 24px;
+    height: 24px;
+}
 </style>

+ 5 - 0
src/pages/useCoupon/useCoupon.js

@@ -0,0 +1,5 @@
+import Vue from 'vue'
+import App from './useCoupon.vue'
+
+const app = new Vue(App)
+app.$mount()

+ 4 - 0
src/pages/useCoupon/useCoupon.json

@@ -0,0 +1,4 @@
+{
+    "navigationBarTitleText": "我的优惠券",
+    "backgroundColor": "#f2f4f5"
+}

+ 103 - 0
src/pages/useCoupon/useCoupon.vue

@@ -0,0 +1,103 @@
+<template>
+    <div class="container">
+        <div class="notUse" @click="updateChoose(0)">
+            <span>不使用优惠券</span>
+
+            <img
+                class="chooseImg"
+                v-if="couponId==0"
+                src="/static/images/gouwuche_icon_xuanzhong.png"
+                alt
+            />
+            <img class="chooseImg" v-else src="/static/images/gouwuche_icon_weixuanzhong.png" alt />
+        </div>
+        <myCoupon
+            v-for="(item,index) in couponList"
+            :key="index"
+            :info="item.couponInfo"
+            type="use"
+            :isChoose="couponId==item.id"
+            @chooseId="updateChoose"
+            :submitId="item.id"
+        ></myCoupon>
+
+        <!-- <div class="couponTitle">以下优惠券不可使用</div>
+        <myCoupon :stauts="1"  v-for="(item,index) in notUseList" :key="index" :info="item"></myCoupon>-->
+    </div>
+</template>
+<script>
+import { mapState } from "vuex";
+import myCoupon from "../../components/MyCoupon";
+export default {
+    name: "",
+    data() {
+        return {
+            money: 0,
+            couponList: []
+        };
+    },
+    computed: {
+        ...mapState(["userInfo", "couponId"])
+    },
+    onLoad(options) {
+        if (options.money) {
+            this.money = options.money;
+        }
+
+        this.$http
+            .get("/userCoupon/best", {
+                userId: this.userInfo.id,
+                price: this.money
+            })
+            .then(res => {
+                if (res.success) {
+                    this.couponList = res.data;
+                }
+            });
+    },
+    methods: {
+        updateChoose(id) {
+            this.$store.commit("updateCouponId", id);
+            wx.navigateBack();
+        }
+    },
+    components: {
+        myCoupon
+    }
+};
+</script>
+<style lang='less' scoped>
+.container {
+    background-color: #f2f4f5;
+    min-height: 100%;
+    padding: 15px;
+    box-sizing: border-box;
+}
+.couponTitle {
+    font-size: 14px;
+    color: rgba(77, 77, 77, 1);
+    line-height: 20px;
+    padding: 10px 0;
+}
+.chooseImg {
+    width: 22px;
+    height: 22px;
+}
+
+.notUse {
+    height: 44px;
+    background: rgba(255, 255, 255, 1);
+    border-radius: 8px;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 0 15px 0 20px;
+    margin-bottom: 10px;
+
+    span {
+        font-size: 14px;
+        color: rgba(0, 0, 0, 1);
+        line-height: 20px;
+    }
+}
+</style>

+ 3 - 7
src/pages/user/user.vue

@@ -60,11 +60,7 @@
                 <div class="name">我的积分</div>
                 <img src="/static/images/icon_inter.png" alt="">
             </navigator>
-            <navigator :url="'/pages/myCoupon/myCoupon'" class="menu-item">
-                <img src="/static/images/info_icon_jifen(1).png" alt="">
-                <div class="name">我的优惠券</div>
-                <img src="/static/images/icon_inter.png" alt="">
-            </navigator>
+          
 
             <navigator :url="'/pages/myAddress/myAddress'" class="menu-item">
                 <img src="/static/images/info_icon_jifen(2).png" alt="">
@@ -77,11 +73,11 @@
                 <div class="name">我的积分</div>
                 <img src="/static/images/icon_inter.png" alt="">
             </div>
-            <div @click="goNext" class="menu-item">
+            <navigator :url="'/pages/myCoupon/myCoupon'" class="menu-item">
                 <img src="/static/images/info_icon_jifen(1).png" alt="">
                 <div class="name">我的优惠券</div>
                 <img src="/static/images/icon_inter.png" alt="">
-            </div>
+            </navigator>
 
             <div @click="goNext" class="menu-item">
                 <img src="/static/images/info_icon_jifen(2).png" alt="">

+ 5 - 1
src/store/store.js

@@ -11,7 +11,8 @@ const store = new Vuex.Store({
         storeId: 13,
         openInfo: {},
         changeOrder: false,
-        miniId: 1
+        miniId:1,
+        couponId:0,
     },
     mutations: {
         updateChangeOrder(state, changeOrder) {
@@ -29,6 +30,9 @@ const store = new Vuex.Store({
         updateStoreInfo(state, storeInfo) {
             state.storeInfo = storeInfo;
         },
+        updateCouponId(state,id){
+            state.couponId=id;
+        }
     },
 });
 export default store;

+ 2 - 2
src/utils/http.js

@@ -58,7 +58,7 @@ export default {
           });
         });
       },
-      post(url, data, options) {
+      post(url, data, options, needStore) {
         options = options || {};
         let self = this;
         return new Promise((resolve, reject) => {
@@ -67,7 +67,7 @@ export default {
             url: parseUrl(url),
             data: {
               ...data,
-              storeId: self.storeId,
+              storeId: needStore == false ? '' : self.storeId,
             },
             dataType: 'json',
             header: {

BIN
static/images/icon_fangda.png