123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552 |
- <template>
- <view>
- <view class="inner-box">
- <!-- 药品列表 -->
- <view class="shopbox" v-for="(shop,idx) in carts" :key="idx">
- <view class="shopbox-name" v-if="shop.storeName && shop.storeName != 'null'">
- <!-- <label style="margin-right: 30upx;">
- <checkbox :value="shop.checked" :checked="chooseOrderKey == shop.createOrderKey" @click="choose(shop)" />
- </label> -->
- <text>{{shop.storeName}}</text>
- </view>
- <view class="goods-list">
- <view v-for="(item,index) in shop.list" :key="index" class="item" @click="showDetail(item)">
- <view class="img-box">
- <image :src="item.productAttrImage?item.productAttrImage:item.productImage" mode="aspectFill"></image>
- </view>
- <view class="info-box">
- <view>
- <view class="name-box ellipsis2">
- <view class="tag">{{utils.getDictLabelName("storeProductType",item.productType)}}</view>{{item.productName}}
- </view>
- <view class="spec ellipsis2">{{item.productAttrName}}</view>
- </view>
- <view class="price-num">
- <view class="price">
- <text class="unit">¥</text>
- <text class="num">{{item.price.toFixed(2)}}</text>
- </view>
- <view class="num">x{{item.cartNum}}</view>
- </view>
- </view>
- </view>
- <!-- 小计 -->
- <view class="sub-total">
- <view class="x-f">
- <text class="label">合计金额:</text>
- <view class="price">
- <text class="unit">¥</text>
- <text class="num">{{shop.totalMoney.toFixed(2)}}</text>
- </view>
- </view>
- <view class="x-f" style="margin-left: 20rpx;">
- <text class="label">实付金额:</text>
- <view class="price">
- <text class="unit">¥</text>
- <text class="num">{{shop.payMoney.toFixed(2)}}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 底部按钮 -->
- <view class="btn-foot">
- <view class="right">
- <view class="total" >
- <text class="label">总金额:</text>
- <view class="price">
- <text class="unit">¥</text>
- <text class="num">{{price.totalPrice.toFixed(2)}}</text>
- </view>
- </view>
- <view class="btn" @click="openUpdateMoney()" >
- 实收金额
- </view>
- <view class="btn" >
- 分享
- <button class="share" data-name="shareBtn" open-type="share">分享</button>
- </view>
- </view>
- </view>
- <modal v-if="inputShow" title="实收金额" confirm-text="保存" cancel-text="取消" @cancel="cancelUpdateMoney" @confirm="confirmUpdateMoney">
- <view style="margin-bottom: 20rpx;color: #333;">选择店铺:</view>
- <view class="shopbox-pop">
- <view v-for="(shop,idx) in carts" :key="idx">
- <view class="shopbox-name" v-if="shop.storeName && shop.storeName != 'null'" style="margin-bottom: 20rpx;" @click="choose(shop,idx)">
- <label style="margin-right: 20upx;">
- <checkbox :value="shop.checked" :checked="chooseOrderKey == shop.createOrderKey"/>
- </label>
- <text>{{shop.storeName}}</text>
- </view>
- </view>
- </view>
- <view class="rowbox x-f" :style="{visibility: chooseOrderKey ? 'visible':'hidden',color: '#333'}">店铺合计金额:¥{{carts[idx].totalMoney.toFixed(2)}}</view>
- <view class="rowbox x-f">
- <text style="margin-right: 20upx;color: #333;flex-shrink: 0;">实收金额</text>
- <input type="text" v-model="inputTxt" placeholder="请输入实收金额" class="intxt" maxlength="8" />
- </view>
- <!-- <view class="rowbox x-f">
- <text style="margin-right: 20upx;color: #333;flex-shrink: 0;">代收金额</text>
- <input type="text" v-model="inputTxt" placeholder="请输入代收金额" class="intxt" maxlength="8" />
- </view> -->
- </modal>
- </view>
- </template>
- <script>
- import {getSalesOrder,getSalesOrders,addUserCart,updateSalseOrderMoney,updateSaleOrderMoney} from '@/api/companyOrder.js'
- export default {
- data() {
- return {
- inputShow:false,
- inputTxt:null,
- orderKey:null,
- price:{
- payPrice:0.00,
- totalPrice:0.00,
- },
- carts:[],
- chooseOrderKey: '',
- idx: 0
-
- }
- },
- onLoad(option) {
- this.orderKey=option.orderKey;
- this.getSalesOrder();
-
- },
- //发送给朋友
- onShareAppMessage(res) {
- return {
- title: "壹柒玖康养集团-您的专属健康解决方案",
- path: '/pages_company/order/confirmOrder?orderKey='+this.orderKey,
- imageUrl: '/static/images/logo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
- }
-
- },
- //分享到朋友圈
- onShareTimeline(res) {
- return {
- title:"壹柒玖康养集团-您的专属健康解决方案",
- query:'orderKey='+this.orderKey,
- imageUrl: '/static/images/logo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
- }
- },
- methods: {
- choose(shop,idx) {
- this.chooseOrderKey = this.chooseOrderKey == shop.createOrderKey ? "" : shop.createOrderKey
- this.idx = this.chooseOrderKey ? idx : 0
- },
- openUpdateMoney(){
- this.chooseOrderKey = ""
- this.idx = 0
- this.inputTxt = null
- this.inputShow = true
- // if(this.chooseOrderKey) {
- // this.inputTxt = null
- // this.inputShow = true
- // } else {
- // uni.showToast({
- // title: "请先选择订单",
- // icon: "none"
- // })
- // }
- },
- cancelUpdateMoney(){
- this.chooseOrderKey = ""
- this.idx = 0
- this.inputShow = false
- },
- confirmUpdateMoney(){
- if(!this.chooseOrderKey) {
- uni.showToast({
- title: "请先选择订单",
- icon: "none"
- })
- return
- }
- if(parseFloat(this.inputTxt)>0){
- // var that=this;
- // var data={createOrderKey:this.chooseOrderKey,token:uni.getStorageSync('CompanyUserToken'),money:this.inputTxt}
- // updateSalseOrderMoney(data).then(
- // res => {
- // if(res.code==200){
- // this.chooseOrderKey = ""
- // this.inputShow = false
- // this.getSalesOrder();
- // }else{
- // uni.showToast({
- // icon:'none',
- // title: res.msg,
- // });
- // }
- // },
- // rej => {}
- // );
- // 多店铺修改实付金额
- const param = {
- token:uni.getStorageSync('CompanyUserToken'),
- vos: this.carts.map(item => ({
- createOrderKey: item.createOrderKey, // 购物车id
- totalPrice: item.totalMoney,//原价
- payPrice: item.createOrderKey == this.chooseOrderKey ? Number(this.inputTxt || 0) : item.payMoney//实收价
- }))
- }
- console.log(param)
- updateSaleOrderMoney(param).then(res => {
- if(res.code==200){
- this.chooseOrderKey = ""
- this.idx = 0
- this.inputShow = false
- this.getSalesOrder();
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- }
- else{
- uni.showToast({
- icon:'none',
- title: "价格应大于0",
- });
- }
- },
- showDetail(item) {
- uni.navigateTo({
- url: 'productDetails?productId='+item.productId
- })
- },
- getSalesOrder(){
-
- var that=this;
- that.price.payPrice=0;
- that.price.totalPrice=0;
- var data={createOrderKeys:this.orderKey}
- getSalesOrders(data).then(
- res => {
- if(res.code==200){
- this.carts=res.carts;
- this.carts.forEach(function(element) {
- that.price.totalPrice += element.payMoney;
- // element.payPrice = 0
- // element.list.forEach(el=>{
- // element.payPrice += el.price * el.cartNum;
- // })
- });
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- },
-
- }
- }
- </script>
- <style lang="scss">
- .intxt {
- border: 1rpx solid #eee;
- padding: 10rpx 20rpx;
- border-radius: 10rpx;
- }
- .rowbox {
- margin-bottom: 20rpx;
- }
- .shopbox-pop {
- max-height: 40vh;
- overflow-y: auto;
- box-sizing: border-box;
- margin-bottom: 30rpx;
- .shopbox-name {
- background-color: #fff;
- padding: 20rpx;
- border-radius: 10rpx;
- }
- }
- .inner-box{
- padding: 20upx 20upx 140upx;
- .shopbox {
- background-color: #FFFFFF;
- border-radius: 16upx;
- margin-bottom: 20upx;
- }
- .shopbox-name {
- padding: 30rpx 30rpx 0 30rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 30rpx;
- color: #111;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .goods-list{
- // margin-top: 20upx;
- padding: 0 30upx;
- background-color: #FFFFFF;
- border-radius: 16upx;
- .item{
- padding: 30upx 0;
- border-bottom: 1px solid #EDEEEF;
- display: flex;
- align-items: center;
- .img-box{
- width: 160upx;
- height: 160upx;
- margin-right: 30upx;
- image{
- width: 100%;
- height: 100%;
- }
- }
- .info-box{
- width: calc(100% - 190upx);
- height: 160upx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .name-box{
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 40upx;
- .tag{
- display: inline-block;
- padding: 0 6upx;
- height: 30upx;
- background: linear-gradient(90deg, #66b2ef 0%, #0bb3f2 100%);
- border-radius: 4upx;
- margin-right: 10upx;
- font-size: 22upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FFFFFF;
- line-height: 30upx;
- float: left;
- margin-top: 7upx;
- }
- }
- .spec{
- margin-top: 10upx;
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 1;
- }
- .price-num{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .price{
- display: flex;
- align-items: flex-end;
- .unit{
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 1.2;
- margin-right: 4upx;
- }
- .num{
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 1;
- }
- }
- .num{
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 1;
- }
- }
- }
- }
- .sub-total{
- height: 88upx;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- .label{
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- }
- .price{
- display: flex;
- align-items: flex-end;
- .unit{
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FF6633;
- line-height: 1.2;
- margin-right: 4upx;
- }
- .num{
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FF6633;
- line-height: 1;
- }
- }
- }
- }
- .points{
- height: 88upx;
- padding: 0 30upx;
- background: #FFFFFF;
- border-radius: 16upx;
-
- display: flex;
- align-items: center;
- justify-content: space-between;
- .left{
- display: flex;
- align-items: center;
- image{
- width: 28upx;
- height: 28upx;
- margin-right: 20upx;
- }
- .text{
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- }
- }
- .right{
- display: flex;
- align-items: center;
- .text{
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
-
- }
- image{
- margin-left: 15upx;
- width: 14upx;
- height: 24upx;
- }
- }
- }
- .remarks{
- height: 88upx;
- padding: 0 30upx;
- background: #FFFFFF;
- border-radius: 16upx;
- margin-top: 20upx;
- display: flex;
- align-items: center;
- input{
- width: 100%;
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #000000;
- }
- .input{
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- }
- }
- }
- .btn-foot{
- box-sizing: border-box;
- width: 100%;
- height: 121upx;
- background: #FFFFFF;
- padding: 16upx 30upx;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- position: fixed;
- left: 0;
- bottom: 0;
- z-index: 99;
- .right{
- display: flex;
- align-items: center;
- .total{
- display: flex;
- align-items: flex-end;
- margin-right: 15upx;
- .label{
- font-size: 26upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 1.5;
- }
- .price{
- display: flex;
- align-items: flex-end;
- .unit{
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FF6633;
- line-height: 1.2;
- margin-right: 10upx;
- }
- .num{
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FF6633;
- line-height: 1;
- }
- }
- }
- .btn{
- margin-left: 10rpx;
- width: 180upx;
- height: 88upx;
- line-height: 88upx;
- text-align: center;
- font-size: 30upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FFFFFF;
- background: #0bb3f2;
- border-radius: 44upx;
- position: relative;
- .share{
- display: inline-block;
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%rpx;
- opacity: 0;
- }
- }
- }
- }
- </style>
-
|