1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<template>
    <view class="user-datail" :data-theme='theme()' :class="theme() || ''">
        <view class="user-body p30 bg-white">
            <view class="f28">
                <view class="d-s-c p-20-0 border-b">
                    <view class="w160 mr10">操作类型</view>
                    <radio-group class="d-a-c" @change="changeRadio($event)">
                        <label class="d-s-c make-item ">
                            <view>
                                <radio style="transform:scale(0.7)" color="#ff6633" :checked="form.mode == 'inc'" :value="inc" />
                            </view>
                            <view class="color-57">增加积分</view>
                        </label>
                        <label class="d-s-c make-item ">
                            <view>
                                <radio style="transform:scale(0.7)" color="#ff6633" :checked="form.mode == 'dec'" :value="dec" />
                            </view>
                            <view class="color-57">减少积分</view>
                        </label>
                    </radio-group>
                </view>
                <view class="d-s-c p-20-0 border-b">
                    <view class="w160 mr10">变更数量</view>
                    <input type="number" class="make-item input-box" v-model="form.value" placeholder="请输入变更数量" />
                </view>
                <view class="d-s-c p-20-0 border-b">
                    <view class="w160 mr10">小票商家</view>
                    <view class="d-s-c flex-1" @tap="StoreUp">
                        <view class="flex-1">{{store_name}}</view>
                        <view class="icon iconfont icon-jiantou ml80 f-s-0"></view>
                    </view>
                </view>
                <view class="d-s-s p-20-0">
                    <view class="w160 mr10">备注</view>
                    <view class="flex-1"><textarea v-model="form.remark" placeholder="选填" class="text_area" /></view>
                </view>
            </view>
            <view class="pt40"><button class="theme-btn send_btn" @click="onSubmit">确认</button></view>
            <StoreList :showStore="showStore" @close="closeStoreFunc"></StoreList> 
        </view>
    </view>
</template>
 
<script>
    import Popup from '@/components/uni-popup.vue'
    import utils from '@/common/utils.js';
    import StoreList from './storelist.vue';
    export default {
        components: {
            StoreList
        },
        data() {
            return {
                loading: true,
                form: {
                    mode: 'inc',
                    store_id: 0,
                    shop_supplier_id: 0,
                    value: '',
                    remark: ''
                },
                store_name: '请选择',
                showStore: false
            };
        },
        props: ['user_id'],
        onLoad(e) {
            
        },
        mounted() {
            let self = this;
            self.$fire.on('selectStoreId', function(e) {
                self.store_name = e.store_name;
                self.form.store_id = e.store_id;
                self.form.shop_supplier_id = e.shop_supplier_id;
            });
        },
        methods: {
            /*获取数据*/
            getData() {
                let self = this;
                uni.showLoading({
                    title: '加载中'
                });
                self._get(
                    'user.qrcode/detail', {
                        user_id: self.user_id
                    },
                    function(res) {
                        self.loading = false;
                        self.user = res.data.user;
                        
                        // self.extractStore = res.data.order.extractStore;
                        uni.hideLoading();
                    },
                    function(res) {
                        uni.switchTab({
                            url:'/pages/index/index'
                        })
                    }
                );
            },
            
            StoreUp() {
                this.showStore = true;
            },
            
            closeStoreFunc(e) {
                this.showStore = false;
                console.log(e);
            },
            
            changeRadio(e) {
                this.mode = e.detail.value;
            },
 
            /*核销*/
            onSubmit() {
                let self = this;
                let params = self.form;
                params.user_id = self.user_id;
                params.source = 'points';
                if (!params.value || params.value < 0) {
                    uni.showToast({
                        title: '请输入有效的积分数量',
                        duration: 2000,
                        icon:'none'
                    });
                    return;
                }
                if (params.store_id == 0) {
                    uni.showToast({
                        title: '请选择小票商家',
                        duration: 2000,
                        icon:'none'
                    });
                    return;
                }
                wx.showModal({
                    title: "提示",
                    content: "您确定要提交吗?",
                    success: function(o) {
                        o.confirm && self._post(
                            'user.qrcode/recharge', params,
                            function(res) {
                                uni.showToast({
                                    title: res.msg,
                                    duration: 2000,
                                    icon: 'success',
                                });
                                setTimeout(function () {
                                    self.gotoPage('/pages/index/index');
                                }, 2000);
                            }
                        );
                    }
                });
            },
        }
    };
</script>
 
<style lang="scss" scoped>
    .user-header {
        position: relative;
        height: 100%;
        @include background_color('background_color');
    }
    
    .user-header .user-info {
        display: flex;
        justify-content: flex-start;
        align-items: center;
    }
    
    .user-header .photo,
    .user-header .photo image {
        width: 50rpx;
        height: 50rpx;
        border-radius: 50%;
    }
    
    .user-header .photo {
        border: 2rpx solid #ffffff;
    }
    
    .user-header .info {
        padding-left: 20rpx;
        box-sizing: border-box;
        overflow: hidden;
        color: #FFFFFF;
    }
    
    .user-header .info .name {
        font-size: 26rpx;
    }
    .w160 {
        width: 160rpx;
    }
    .d-f-c {
        display: flex;
        justify-content: space-between;
        align-items: center;
        overflow: hidden;
    }
    .text_area{
        width: 100%;
        height: 80rpx;
        box-sizing: border-box;
        // font-size: 28rpx;
    }
    
</style>