|
|
@@ -0,0 +1,271 @@
|
|
|
+<template>
|
|
|
+ <view class="app-content">
|
|
|
+ <view class="billing_box_bg">
|
|
|
+ <view class="top-view"> </view>
|
|
|
+ <view class="result-view">
|
|
|
+ <view class="iconfont iconchenggong"></view>
|
|
|
+ <view class="result-title">添加成功</view>
|
|
|
+ <button class="admin-button-com middle blue" style="width:20vw;" @click="goBack">返回</button>
|
|
|
+ <view class="form-container">
|
|
|
+ <form>
|
|
|
+ <view class="module-com input-line-wrap">
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">名称</view>
|
|
|
+ <view>{{ goodsName }}</view>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">数量</view>
|
|
|
+ <input v-model="form.num" placeholder-class="phcolor" class="tui-input" name="num" @focus="form.num=''" placeholder="填写数量" maxlength="50" type="number" />
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="false" >
|
|
|
+ <view class="tui-title">单价</view>
|
|
|
+ <input type="digit" @focus="goodsPrice=''" style="width:260upx;" v-model="goodsPrice" placeholder-class="tui-placeholder" placeholder="填写金额" />
|
|
|
+ <text style="color:#3385FF;font-weight:bold;">合计 ¥<text>{{orderTotalPrice}}</text></text>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
+ <view class="tui-title">收款方式</view>
|
|
|
+ <button @click="form.hasPay = 4" class="admin-button-com middle" :class="form.hasPay == 4 ? 'blue' : 'default'">余额</button>
|
|
|
+ <button @click="form.hasPay = 0" class="admin-button-com middle" :class="form.hasPay == 0 ? 'blue' : 'default'" style="margin-left:6upx;">扫码</button>
|
|
|
+ <button @tap="form.hasPay = 1" class="admin-button-com middle" :class="form.hasPay == 1 ? 'blue' : 'default'" style="margin-left:6upx;">线下</button>
|
|
|
+ <button @tap="form.hasPay = 2" class="admin-button-com middle" :class="form.hasPay == 2 ? 'blue' : 'default'" style="margin-left:6upx;">赊账</button>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :arrow="true" v-if="form.hasPay == 1">
|
|
|
+ <view class="tui-title">线下渠道</view>
|
|
|
+ <picker mode="selector" :value="form.payWay" :range="payWayList" range-key="name" @change="payWayChange" class="tui-input" >
|
|
|
+ <input v-model="form.payWay" name="payWay" type="text" hidden />
|
|
|
+ <view style="padding:6upx 0 6upx 0;">{{payWayList[payWayindex].name}}</view>
|
|
|
+ </picker>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">配送方式</view>
|
|
|
+ <button @tap="setSendType(0)" class="admin-button-com middle" :class="form.sendType == 0 ? 'blue' : 'default'">送货</button>
|
|
|
+ <button @tap="setSendType(1)" class="admin-button-com middle" :class="form.sendType == 1 ? 'blue' : 'default'" style="margin-left:6upx;">自取</button>
|
|
|
+ <button @click="setSendType(2)" class="admin-button-com middle" :class="form.sendType == 2 ? 'blue' : 'default'" style="margin-left:6upx;">跑腿</button>
|
|
|
+ <button @click="setSendType(3)" class="admin-button-com middle" :class="form.sendType == 3 ? 'blue' : 'default'" style="margin-left:6upx;">物流</button>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="true">
|
|
|
+ <view class="tui-title" v-if="form.sendType == 1">取花日期</view>
|
|
|
+ <view class="tui-title" v-else>配送日期</view>
|
|
|
+ <picker mode="date" :value="form.reachDate" @change="selTimeFn" class="tui-input">
|
|
|
+ <view v-if="form.reachDate">{{ form.reachDate }}</view>
|
|
|
+ <view v-else>今天</view>
|
|
|
+ </picker>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
+ <view class="tui-title" v-if="form.sendType == 1">取花时间</view>
|
|
|
+ <view class="tui-title" v-else>配送时间</view>
|
|
|
+ <picker mode="multiSelector" :value="form.reachPeriod" :range="timeOptions" @change="bindTimeChange">
|
|
|
+ <view class="uni-input" style="width:450upx;">{{form.reachPeriod}}<text style="margin-left:10upx;">前</text></view>
|
|
|
+ </picker>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">备注内容</view>
|
|
|
+ <input v-model="form.remark" placeholder-class="phcolor" class="tui-input" placeholder-style="color:#ccc" name="remark" placeholder="选填" />
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">客户</view>
|
|
|
+ <view>快捷开单</view>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">制作</view>
|
|
|
+ <button @tap="form.needWork = 1" class="admin-button-com middle" :class="form.needWork == 1 ? 'blue' : 'default'">需要</button>
|
|
|
+ <button @tap="form.needWork = 0" class="admin-button-com middle" :class="form.needWork == 0 ? 'blue' : 'default'" style="margin-left:30upx;">不要</button>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ </form>
|
|
|
+ <view class="button-group">
|
|
|
+ <button class="admin-button-com big default" @click="goBack" style="width:200upx;">取消</button>
|
|
|
+ <button class="admin-button-com big blue" @click="confirmOrder" style="width:200upx;margin-left:50upx;">确认</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import TuiListCell from "@/components/plugin/list-cell";
|
|
|
+import { createOrder } from "@/api/order";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "result",
|
|
|
+ components: {
|
|
|
+ TuiListCell
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ form: {
|
|
|
+ hasPay: 4,
|
|
|
+ payWay: 0,
|
|
|
+ num: 1,
|
|
|
+ sendType: 0,
|
|
|
+ reachDate: '',
|
|
|
+ reachPeriod: "12:00",
|
|
|
+ remark: '',
|
|
|
+ needWork:1
|
|
|
+ },
|
|
|
+ goodsPrice: '',
|
|
|
+ payWayindex: 0,
|
|
|
+ payWayList: [
|
|
|
+ {name: "线下微信", id: 0},
|
|
|
+ {name: "线下支付宝", id: 1},
|
|
|
+ {name: "现金", id: 4},
|
|
|
+ {name: "银行卡", id: 5}
|
|
|
+ ],
|
|
|
+ timeOptions: [
|
|
|
+ ['00', '01', '02','03','04','05','06','07','08','09','10','11','12','13', '14','15','16','17','18','19','20','21','22','23'],
|
|
|
+ ['00', '05', '10','15','20','25','30','35','40','45','50','55']
|
|
|
+ ],
|
|
|
+ goodsName:'',
|
|
|
+ goodsId:0
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["getLoginInfo", "getMyShopInfo"]),
|
|
|
+ orderTotalPrice() {
|
|
|
+ let price = 0;
|
|
|
+ if (Number(this.goodsPrice) > 0 && Number(this.form.num) > 0) {
|
|
|
+ price = Number(this.goodsPrice) * Number(this.form.num);
|
|
|
+ price = parseFloat(price.toFixed(2));
|
|
|
+ }
|
|
|
+ return price;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.goodsName = options.name?options.name:''
|
|
|
+ this.goodsId = options.id?options.id:0
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init() {
|
|
|
+
|
|
|
+ },
|
|
|
+ setSendType (type) {
|
|
|
+ this.form.sendType = type
|
|
|
+ },
|
|
|
+ goBack() {
|
|
|
+ uni.navigateBack({})
|
|
|
+ },
|
|
|
+ confirmOrder() {
|
|
|
+ let product = [{productId:this.goodsId,bigNum:this.form.num,smallNum:null,property:0,num:this.form.num,unitType:0,unitPrice:this.goodsPrice}]
|
|
|
+ let json = JSON.stringify(product)
|
|
|
+ let customId = this.getMyShopInfo && Number(this.getMyShopInfo.defaultCustomId)>0 ? this.getMyShopInfo.defaultCustomId : 0
|
|
|
+ if(Number(customId)<=0){
|
|
|
+ this.$msg('请设置快捷开单的客户')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let params = {...this.form,modifyPrice: this.orderTotalPrice,version:3,orderType:1,product:json,customId:customId};
|
|
|
+
|
|
|
+ this.$util.confirmModal({content:'确认提交'},() => {
|
|
|
+ uni.showLoading({mask:true})
|
|
|
+ createOrder(params).then((res) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ if(res.code == 1){
|
|
|
+ const {data: { id, orderSn,actPrice }} = res;
|
|
|
+ if(this.form.hasPay == 0){
|
|
|
+ this.$util.pageTo({ url: '/admin/billing/toPay',type:2,query: {orderId:id,orderSn:orderSn,actPrice:actPrice}})
|
|
|
+ }else{
|
|
|
+ this.$util.pageTo({ url: '/admin/billing/result?orderId='+id,type:2})
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ payWayChange(e) {
|
|
|
+ let index = e.detail.value;
|
|
|
+ this.payWayindex = index;
|
|
|
+ this.form.payWay = this.payWayList[index].id;
|
|
|
+ },
|
|
|
+ selTimeFn(e) {
|
|
|
+ this.form.reachDate = e.detail.value;
|
|
|
+ },
|
|
|
+ bindTimeChange(event) {
|
|
|
+ let val = event.detail.value;
|
|
|
+ let before = Number(val[0]);
|
|
|
+ let after = Number(val[1]);
|
|
|
+ let timeOptions = this.timeOptions;
|
|
|
+ this.form.reachPeriod = timeOptions[0][before]+':'+timeOptions[1][after];
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.billing_box_bg {
|
|
|
+ position: relative;
|
|
|
+ padding: 30upx 30upx;
|
|
|
+ display: flex;
|
|
|
+ background: white;
|
|
|
+ flex-direction: column;
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ .top-view {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 299upx;
|
|
|
+ background: #3385ff;
|
|
|
+ border-radius: 0upx 0upx 83upx 83upx;
|
|
|
+ }
|
|
|
+ .result-view {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ padding:25upx 0 30upx;
|
|
|
+ width: 100%;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 20upx;
|
|
|
+ z-index: 1;
|
|
|
+ .iconchenggong {
|
|
|
+ font-size: 100upx;
|
|
|
+ color: $mainColor1;
|
|
|
+ }
|
|
|
+ .result-title {
|
|
|
+ margin: 10upx 0 10upx;
|
|
|
+ font-size: 32upx;
|
|
|
+ }
|
|
|
+ .form-container {
|
|
|
+ width: 100%;
|
|
|
+ .line-cell {
|
|
|
+ .tui-title {
|
|
|
+ width: 210upx;
|
|
|
+ color: $fontColor2;
|
|
|
+ &.required::before {
|
|
|
+ content: '*';
|
|
|
+ color: #ff0000;
|
|
|
+ margin-right: 4upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .tui-input {
|
|
|
+ width: calc(100% - 210upx);
|
|
|
+ font-size: 28upx;
|
|
|
+ }
|
|
|
+ .tui-placeholder {
|
|
|
+ color: #ccc;
|
|
|
+ }
|
|
|
+ .phcolor {
|
|
|
+ color: #ccc;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .button-group {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ margin-top: 40upx;
|
|
|
+ padding: 0 30upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|