123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <view>
- <view class="mtop"><image src="../../static/my.jpg" mode="widthFix"></image></view>
- <view class="time">上次上报:{{ time }}</view>
- <view class="cn">
- <view class="info">
- <view class="form_group hr">
- <view class="lable">散客预约人数</view>
- <input type="text" placeholder="请输入散客预约人数" v-model="item.scatteredAppointment" />
- </view>
- <view class="form_group hr">
- <view class="lable">散客接待人数</view>
- <input type="number" placeholder="请输入散客接待人数" v-model="item.scatteredReception" />
- </view>
- <view class="form_group hr">
- <view class="lable">团客预约人数</view>
- <input type="number" placeholder="请输入团客预约人数" v-model="item.groupAppointment" />
- </view>
- <view class="form_group hr">
- <view class="lable">团客接待人数</view>
- <input type="number" placeholder="请输入团客接待人数" v-model="item.groupReception" />
- </view>
- <view class="form_group hr">
- <view class="lable">销售金额(元)</view>
- <input type="number" placeholder="请输入销售金额" v-model="item.salesAmount" />
- </view>
- </view>
- <button class="btn" @click="up()">上报数据</button>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- item: {},
- time: '未上报过'
- };
- },
- onLoad(e) {
- if (e.item) {
- let shop = JSON.parse(e.item);
- this.item.shopId = shop.shopId;
- if (shop.shopType == 1) {
- this.$nextTick(() => {
- uni.setNavigationBarTitle({
- title: '门店数据上报'
- });
- });
- }
- if (shop.shopType == 2) {
- this.$nextTick(() => {
- uni.setNavigationBarTitle({
- title: '酒店数据上报'
- });
- });
- }
- }
- if (uni.getStorageSync('time') != '') {
- this.time = this.$u.timeFrom(new Date(uni.getStorageSync('time').replace(/\-/g, '/')).getTime());
- }
- },
- methods: {
- up() {
- let rule = [
- { name: 'scatteredAppointment', checkType: 'notnull', errorMsg: '请输入散客预约人数' },
- { name: 'scatteredReception', checkType: 'notnull', errorMsg: '请输入散客接待人数' },
- { name: 'groupAppointment', checkType: 'notnull', errorMsg: '请输入团客预约人数' },
- { name: 'groupReception', checkType: 'notnull', errorMsg: '请输入团客接待人数' },
- { name: 'salesAmount', checkType: 'notnull', errorMsg: '请输入销售金额' }
- ];
- if (!this.$verify.check(this.item, rule)) {
- uni.showModal({ content: this.$verify.error, showCancel: false });
- return;
- }
- this.$http.request({
- method: 'POST',
- url: this.$http.urls.pushRecord,
- data: this.item,
- success: res => {
- uni.showToast({ title: '上报成功' });
- uni.setStorageSync('time', this.$util.getDate('time'));
- setTimeout(() => {
- uni.navigateBack();
- }, 700);
- }
- });
- }
- }
- };
- </script>
- <style lang="scss">
- .mtop {
- text-align: center;
- image {
- margin-top: 15px;
- width: 40%;
- }
- }
- .time {
- text-align: center;
- color: $dar;
- font-size: 13px;
- }
- .cn {
- padding: 15px;
- .info {
- background-color: white;
- border-radius: 5px;
- margin-top: 10px;
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
- }
- .btn {
- margin-top: 25px;
- }
- }
- </style>
|