| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <template>
- <appResult :title="option.title">
- <view v-if="detailInfo.hasNoticeCustom && detailInfo.hasNoticeCustom == 1" style="margin-bottom:30upx;font-weight:bold;color:#049E2C;font-size:36upx;">【客户已收到新订单提醒】</view>
- <!-- #ifdef MP-WEIXIN -->
- <button v-if="option.title != '报损成功'" class="admin-button-com big blue" open-type="share">
- 分享给<text style="font-weight:bold;margin-left:12upx;">{{customName}}</text>
- </button>
- <!-- #endif -->
- <!-- #ifdef APP-PLUS -->
- <button v-if="option.title != '报损成功'" class="admin-button-com big blue" @click="shareOrder">
- 分享给<text style="font-weight:bold;margin-left:12upx;">{{customName}}</text>
- </button>
- <!-- #endif -->
- <button v-if="option.title != '报损成功'" class="admin-button-com big" @click="gotoOrderDetail">订单详情</button>
- <button v-if="option.title != '报损成功'" class="admin-button-com big" @click="printOrder()">打印(无价格)</button>
- <button class="admin-button-com big" @click="goBackHome">返回首页</button>
- <view style="margin-top:20upx;">
- <block v-for="(item, index) in detailInfo.product" :key="index">
- <view style="text-align:center;margin-bottom:10upx;">
- <text style="font-size:30upx;">
- {{item.name}}
- <text v-if="item.giveNum && Number(item.giveNum)>0" style="color:green;">,已赠{{item.giveNum}}{{item.xhUnitName}}</text>
- </text>
- <button v-if="item.xhUnitType == 1" class="admin-button-com middle" style="margin:10upx auto 0 auto;" @click="partOne(item)">拆1份</button>
- <button v-else class="admin-button-com middle blue" style="margin:10upx auto 0 auto;" @click="giveItemFn(item)">赠送</button>
- </view>
- </block>
- </view>
- <modal-module :show="givePopShow" @click="confirmGive" :maskClosable="true" title="数量" padding="30rpx 30rpx" >
- <template v-slot:content>
- <div class="app-modal-input-wrap">
- <div class="inp-list-line">
- <div class="line-input">
- <input type="number" ref="input" style="width:61.8%;text-align:center;" v-model="giveNum" :adjust-position="false" class="inp-input" @focus="giveNum=''" />
- </div>
- </div>
- </div>
- </template>
- </modal-module>
- </appResult>
- </template>
- <script>
- import { mapGetters } from "vuex"
- import appResult from "@/components/app-result"
- import { getDetail,cloudPrintOrder} from "@/api/order"
- import { getWeixinId } from "@/api/invite"
- import { IMGHOST } from '@/config'
- import { partItem } from "@/api/part"
- import { giveItem } from "@/api/order-item"
- import ModalModule from "@/components/plugin/modal"
- export default {
- name: "result",
- components: {
- appResult,
- ModalModule
- },
- mixins: [],
- data() {
- return {
- detailInfo: {},
- customName:'客户',
- getappIdList: {},
- title:'新订单',
- giveTargetId:0,
- givePopShow:false,
- giveNum:1
- };
- },
- computed: {
- ...mapGetters({ loginInfo: "getLoginInfo",dictInfo:"getDictionariesInfo" }),
- },
- onShareAppMessage(res) {
- console.log("pagesOrder/showOrder?id="+this.detailInfo.purchaseId)
- return {
- title: this.title,
- desc: "",
- imageUrl: IMGHOST+'/custom/order_share.jpg',
- path: "pagesOrder/showOrder?id="+this.detailInfo.purchaseId,
- }
- },
- methods: {
- giveItemFn(item){
- this.givePopShow = true
- this.giveNum = 1
- this.giveTargetId = item.id
- },
- confirmGive(val){
- let that = this
- if (val.index === 0) {
- that.givePopShow = false
- return false
- }
- if(Number(this.giveTargetId)<=0){
- this.$msg('请选择要赠送的花材')
- return false
- }
- if(Number(this.giveNum)<=0){
- this.$msg('请填写赠送数量')
- return false
- }
- this.$util.confirmModal({content:'确认赠送?'},() => {
- uni.showLoading({mask:true})
- giveItem({id:this.giveTargetId,num:this.giveNum}).then(res=>{
- uni.hideLoading()
- if(res.code == 1){
- that.givePopShow = false
- that.init()
- that.$msg(that.msg)
- }
- })
- })
- },
- partOne(item){
- let that = this
- let product = [{ productId: item.productId, bigNum: 1, smallNum: 0, classId: 0, itemId: item.itemId, ratio:item.ratio }]
- that.$util.confirmModal({content:'确认拆1份?'},() => {
- partItem({product:JSON.stringify(product),remark:'开单拆散'}).then((res) => {
- that.init()
- that.$msg(res.msg)
- })
- })
- },
- shareOrder(){
- console.log("pagesOrder/showOrder?id="+this.detailInfo.purchaseId)
- let that = this
- let miniOriginalId = that.dictInfo.miniOriginalId && that.dictInfo.miniOriginalId.current && that.dictInfo.miniOriginalId.current.ghs ? that.dictInfo.miniOriginalId.current.ghs : ''
- uni.share({
- provider: "weixin", //分享服务提供商(即weixin|qq|sinaweibo)
- scene: 'WXSceneSession', //场景,可取值参考下面说明。
- type: 5, //分享形式
- title: that.title, //分享内容的标题
- summary: '暂无', //分享内容的摘要
- imageUrl: IMGHOST+'/custom/order_share.jpg',//图片一定要有,不然会分享失败
- miniProgram: {
- id: miniOriginalId,//小程序原始id,发起分享的 App 与小程序属于同一微信开放平台帐号
- path: "pagesOrder/showOrder?id="+this.detailInfo.purchaseId,
- type: 0,// 0-正式版; 1-测试版; 2-体验版
- webUrl: 'https://www.wixhb.com'
- },
- success: function(res) {
- //console.log(res)
- },
- fail: function(err) {
- //console.log(err)
- }
- })
- },
- async init() {
- if (this.option.title != "报损成功") {
- getWeixinId().then(res => {
- this.getappIdList = res.data
- })
- const res = await getDetail({
- id: this.option.orderId,
- });
- this.detailInfo = res.data;
- let actPrice = this.detailInfo.actPrice ? parseFloat(this.detailInfo.actPrice) : 0
- this.title = this.detailInfo.addTime.substr(5,11)+' ¥'+actPrice
- if(this.detailInfo.customName && !this.$util.isEmpty(this.detailInfo.customName)) {
- this.customName = this.detailInfo.customName
- }
- }
- },
- //发货
- gotoOrderSend() {
- uni.navigateTo({ url: `/pagesOrder/ship?id=${this.option.orderId}` });
- },
- //订单详情
- gotoOrderDetail() {
- this.$util.pageTo({url: "/pagesOrder/detail",type:2,query: { id: this.option.orderId }})
- },
- printOrder(){
- uni.showLoading({title:"打印中..."})
- cloudPrintOrder({id:this.detailInfo.id,showPrice:0}).then((res) => {
- uni.hideLoading()
- })
- },
- gotoPlace() {
- uni.navigateBack({ delta: 1 });
- },
- gotoOrderPrint() {
- uni.navigateTo({ url: `/admin/order/print?id=${this.option.orderId}` });
- },
- goBackHome() {
- this.$util.pageTo({ url: "/admin/home/workbench", type: 4, query: { tabIndex: 0 }})
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .admin-button-com {
- margin-bottom:30upx;
- width: 100%;
- }
- </style>
|