result.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <appResult :title="option.title">
  3. <view v-if="detailInfo.hasNoticeCustom && detailInfo.hasNoticeCustom == 1" style="margin-bottom:30upx;font-weight:bold;color:#049E2C;font-size:36upx;">【客户已收到新订单提醒】</view>
  4. <!-- #ifdef MP-WEIXIN -->
  5. <button v-if="option.title != '报损成功'" class="admin-button-com big blue" open-type="share">
  6. 分享给<text style="font-weight:bold;margin-left:12upx;">{{customName}}</text>
  7. </button>
  8. <!-- #endif -->
  9. <!-- #ifdef APP-PLUS -->
  10. <button v-if="option.title != '报损成功'" class="admin-button-com big blue" @click="shareOrder">
  11. 分享给<text style="font-weight:bold;margin-left:12upx;">{{customName}}</text>
  12. </button>
  13. <!-- #endif -->
  14. <button v-if="option.title != '报损成功'" class="admin-button-com big" @click="gotoOrderDetail">订单详情</button>
  15. <button v-if="option.title != '报损成功'" class="admin-button-com big" @click="printOrder()">打印(无价格)</button>
  16. <button class="admin-button-com big" @click="goBackHome">返回首页</button>
  17. <view style="margin-top:20upx;">
  18. <block v-for="(item, index) in detailInfo.product" :key="index">
  19. <view style="text-align:center;margin-bottom:10upx;">
  20. <text style="font-size:30upx;">
  21. {{item.name}}
  22. <text v-if="item.giveNum && Number(item.giveNum)>0" style="color:green;">,已赠{{item.giveNum}}{{item.xhUnitName}}</text>
  23. </text>
  24. <button v-if="item.xhUnitType == 1" class="admin-button-com middle" style="margin:10upx auto 0 auto;" @click="partOne(item)">拆1份</button>
  25. <button v-else class="admin-button-com middle blue" style="margin:10upx auto 0 auto;" @click="giveItemFn(item)">赠送</button>
  26. </view>
  27. </block>
  28. </view>
  29. <modal-module :show="givePopShow" @click="confirmGive" :maskClosable="true" title="数量" padding="30rpx 30rpx" >
  30. <template v-slot:content>
  31. <div class="app-modal-input-wrap">
  32. <div class="inp-list-line">
  33. <div class="line-input">
  34. <input type="number" ref="input" style="width:61.8%;text-align:center;" v-model="giveNum" :adjust-position="false" class="inp-input" @focus="giveNum=''" />
  35. </div>
  36. </div>
  37. </div>
  38. </template>
  39. </modal-module>
  40. </appResult>
  41. </template>
  42. <script>
  43. import { mapGetters } from "vuex"
  44. import appResult from "@/components/app-result"
  45. import { getDetail,cloudPrintOrder} from "@/api/order"
  46. import { getWeixinId } from "@/api/invite"
  47. import { IMGHOST } from '@/config'
  48. import { partItem } from "@/api/part"
  49. import { giveItem } from "@/api/order-item"
  50. import ModalModule from "@/components/plugin/modal"
  51. export default {
  52. name: "result",
  53. components: {
  54. appResult,
  55. ModalModule
  56. },
  57. mixins: [],
  58. data() {
  59. return {
  60. detailInfo: {},
  61. customName:'客户',
  62. getappIdList: {},
  63. title:'新订单',
  64. giveTargetId:0,
  65. givePopShow:false,
  66. giveNum:1
  67. };
  68. },
  69. computed: {
  70. ...mapGetters({ loginInfo: "getLoginInfo",dictInfo:"getDictionariesInfo" }),
  71. },
  72. onShareAppMessage(res) {
  73. console.log("pagesOrder/showOrder?id="+this.detailInfo.purchaseId)
  74. return {
  75. title: this.title,
  76. desc: "",
  77. imageUrl: IMGHOST+'/custom/order_share.jpg',
  78. path: "pagesOrder/showOrder?id="+this.detailInfo.purchaseId,
  79. }
  80. },
  81. methods: {
  82. giveItemFn(item){
  83. this.givePopShow = true
  84. this.giveNum = 1
  85. this.giveTargetId = item.id
  86. },
  87. confirmGive(val){
  88. let that = this
  89. if (val.index === 0) {
  90. that.givePopShow = false
  91. return false
  92. }
  93. if(Number(this.giveTargetId)<=0){
  94. this.$msg('请选择要赠送的花材')
  95. return false
  96. }
  97. if(Number(this.giveNum)<=0){
  98. this.$msg('请填写赠送数量')
  99. return false
  100. }
  101. this.$util.confirmModal({content:'确认赠送?'},() => {
  102. uni.showLoading({mask:true})
  103. giveItem({id:this.giveTargetId,num:this.giveNum}).then(res=>{
  104. uni.hideLoading()
  105. if(res.code == 1){
  106. that.givePopShow = false
  107. that.init()
  108. that.$msg(that.msg)
  109. }
  110. })
  111. })
  112. },
  113. partOne(item){
  114. let that = this
  115. let product = [{ productId: item.productId, bigNum: 1, smallNum: 0, classId: 0, itemId: item.itemId, ratio:item.ratio }]
  116. that.$util.confirmModal({content:'确认拆1份?'},() => {
  117. partItem({product:JSON.stringify(product),remark:'开单拆散'}).then((res) => {
  118. that.init()
  119. that.$msg(res.msg)
  120. })
  121. })
  122. },
  123. shareOrder(){
  124. console.log("pagesOrder/showOrder?id="+this.detailInfo.purchaseId)
  125. let that = this
  126. let miniOriginalId = that.dictInfo.miniOriginalId && that.dictInfo.miniOriginalId.current && that.dictInfo.miniOriginalId.current.ghs ? that.dictInfo.miniOriginalId.current.ghs : ''
  127. uni.share({
  128. provider: "weixin", //分享服务提供商(即weixin|qq|sinaweibo)
  129. scene: 'WXSceneSession', //场景,可取值参考下面说明。
  130. type: 5, //分享形式
  131. title: that.title, //分享内容的标题
  132. summary: '暂无', //分享内容的摘要
  133. imageUrl: IMGHOST+'/custom/order_share.jpg',//图片一定要有,不然会分享失败
  134. miniProgram: {
  135. id: miniOriginalId,//小程序原始id,发起分享的 App 与小程序属于同一微信开放平台帐号
  136. path: "pagesOrder/showOrder?id="+this.detailInfo.purchaseId,
  137. type: 0,// 0-正式版; 1-测试版; 2-体验版
  138. webUrl: 'https://www.wixhb.com'
  139. },
  140. success: function(res) {
  141. //console.log(res)
  142. },
  143. fail: function(err) {
  144. //console.log(err)
  145. }
  146. })
  147. },
  148. async init() {
  149. if (this.option.title != "报损成功") {
  150. getWeixinId().then(res => {
  151. this.getappIdList = res.data
  152. })
  153. const res = await getDetail({
  154. id: this.option.orderId,
  155. });
  156. this.detailInfo = res.data;
  157. let actPrice = this.detailInfo.actPrice ? parseFloat(this.detailInfo.actPrice) : 0
  158. this.title = this.detailInfo.addTime.substr(5,11)+' ¥'+actPrice
  159. if(this.detailInfo.customName && !this.$util.isEmpty(this.detailInfo.customName)) {
  160. this.customName = this.detailInfo.customName
  161. }
  162. }
  163. },
  164. //发货
  165. gotoOrderSend() {
  166. uni.navigateTo({ url: `/pagesOrder/ship?id=${this.option.orderId}` });
  167. },
  168. //订单详情
  169. gotoOrderDetail() {
  170. this.$util.pageTo({url: "/pagesOrder/detail",type:2,query: { id: this.option.orderId }})
  171. },
  172. printOrder(){
  173. uni.showLoading({title:"打印中..."})
  174. cloudPrintOrder({id:this.detailInfo.id,showPrice:0}).then((res) => {
  175. uni.hideLoading()
  176. })
  177. },
  178. gotoPlace() {
  179. uni.navigateBack({ delta: 1 });
  180. },
  181. gotoOrderPrint() {
  182. uni.navigateTo({ url: `/admin/order/print?id=${this.option.orderId}` });
  183. },
  184. goBackHome() {
  185. this.$util.pageTo({ url: "/admin/home/workbench", type: 4, query: { tabIndex: 0 }})
  186. },
  187. },
  188. };
  189. </script>
  190. <style lang="scss" scoped>
  191. .admin-button-com {
  192. margin-bottom:30upx;
  193. width: 100%;
  194. }
  195. </style>