sellerDetaileButton.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template name="button">
  2. <view class="button-template" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  3. <!-- 底部按钮 -->
  4. <view class="button-content">
  5. <view class="btn btn-cancel" @click.stop="btnagainConfirm('again',order,serviceProviderId)">再来一单</view>
  6. <view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel',order)">取消订单</view>
  7. <view class="btn btn-cancel" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',order)">删除订单</view>
  8. <view class="btn btn-cancel" @click.stop="onShareCode">
  9. <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
  10. 分享订单
  11. </view>
  12. <view class="btn btn-color" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm',order)">确认订单</view>
  13. <view class="btn btn-color" v-if="btnState.isPay && ableUserMoney > 0 && !rechargeGoods" @click.stop="btnConfirm('balance',order)">余额抵扣</view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default{
  19. name:"button",
  20. props:{
  21. status:{
  22. type:Number
  23. },
  24. order: {
  25. type:Object
  26. },
  27. ableUserMoney:{
  28. type:Number
  29. },
  30. rechargeGoods:{
  31. type:Boolean
  32. },
  33. shareCode:{
  34. type:String
  35. },
  36. serviceProviderId:{
  37. type:Number
  38. }
  39. },
  40. watch:{
  41. status:{
  42. handler:function(val){
  43. this.initData(val)
  44. },
  45. deep:true//对象内部的属性监听,也叫深度监听
  46. }
  47. },
  48. data() {
  49. return{
  50. btnState:this.initStatus(),
  51. isIphoneX:this.$store.state.isIphoneX,
  52. invoiceStatus:false,
  53. mapStateArr:[
  54. {label:'isDelete',val:[6],status: true},
  55. {label:'isCancel',val:[0,111],status: true},
  56. {label:'isConfirm',val:[0],status: true},
  57. {label:'isPay',val:[11,12,13,21,22,23,111],status: true},
  58. ]
  59. }
  60. },
  61. created(){
  62. console.log(this.rechargeGoods);
  63. this.initData(this.status)
  64. },
  65. computed: {
  66. },
  67. methods:{
  68. initData(resVal) {
  69. /**
  70. * @分享按钮统一显示
  71. * @按钮根据状态显示
  72. * @(4、5、7、12、22、23、32)显示[查看物流]按钮,其他隐藏
  73. * @(6)显示[删除订单],其他隐藏
  74. * @(0、111)显示[取消订单],其他隐藏
  75. * @(21,31)只显示分享
  76. * @(13,33)显示[确认收货]和[查看物流]
  77. */
  78. this.btnState = this.initStatus()
  79. this.mapStateArr.forEach(el => {
  80. el.val.forEach(value => {
  81. if(resVal === value){
  82. this.btnState[el.label] = el.status
  83. //console.log(this.btnState[el.label]);
  84. }
  85. })
  86. })
  87. },
  88. initStatus(){
  89. let btnState= {
  90. isQuery: false,
  91. isDelete: false,
  92. isCancel: false,
  93. isConfirm: false,
  94. isPay: false,
  95. }
  96. return btnState
  97. },
  98. getShareCode(code){
  99. this.shareCode = code
  100. },
  101. onShareCode(){
  102. if(this.order.onlinePayFlag!= '1'){
  103. this.PayService.PayOrderCheckoutCounter({orderId:this.order.orderID}).then(response =>{
  104. let data = response.data.order
  105. this.invoiceStatus = data.invoiceStatus
  106. //判断线上线下显示
  107. if(this.invoiceStatus){
  108. this.$util.modal('提示','由于商品发票属性的限制,本订单不能进行线上支付,请让客户选择线下转账方式付款','继续分享','知道了',true,() =>{
  109. this.$parent.isShareModal = true
  110. })
  111. }else{
  112. this.$parent.isShareModal = true
  113. }
  114. }).catch(error =>{
  115. this.$util.msg(error.msg,2000)
  116. })
  117. }else{
  118. this.$parent.isShareModal = true
  119. }
  120. // this.$emit('shareConfirm')
  121. },
  122. btnConfirm(type,order){
  123. let data = {
  124. type:type,
  125. orderId:order.orderID,
  126. order:order
  127. }
  128. this.$emit('buttonConfirm',data)
  129. },
  130. btnagainConfirm(type,id,serviceid){
  131. let data = {
  132. type:type,
  133. orderId:id,
  134. serviceProviderId:serviceid,
  135. }
  136. this.$emit('buttonConfirm',data)
  137. },
  138. }
  139. }
  140. </script>
  141. <style lang="scss">
  142. .button-template{
  143. width: 100%;
  144. height: auto;
  145. position: fixed;
  146. bottom: 0;
  147. left: 0;
  148. background: #FFFFFF;
  149. .button-content{
  150. width: 702rpx;
  151. padding:0 24rpx;
  152. height: auto;
  153. float: left;
  154. position: relative;
  155. margin: 20rpx 0;
  156. .share-code{
  157. width: 200rpx;
  158. height: 64rpx;
  159. line-height: 64rpx;
  160. color: #2A45FF;
  161. text-align: left;
  162. position: absolute;
  163. font-size: $font-size-28;
  164. font-weight: bold;
  165. left: 24rpx;
  166. top: 24rpx;
  167. }
  168. .btn{
  169. width: 160rpx;
  170. height: 64rpx;
  171. // margin:22rpx;
  172. line-height: 64rpx;
  173. font-size:$font-size-26;
  174. color: #FFFFFF;
  175. text-align: center;
  176. border-radius: 32rpx;
  177. float: right;
  178. }
  179. .btn-color{
  180. background: #f94b4b;
  181. // margin: 20rpx 0 20rpx 20rpx;
  182. .tips{
  183. width: 160rpx;
  184. height: 34rpx;
  185. padding: 10rpx 10rpx;
  186. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  187. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  188. border-radius: 8rpx;
  189. position: absolute;
  190. color: #FFFFFF;
  191. line-height: 34rpx;
  192. font-size: $font-size-24;
  193. text-align: left;
  194. right: 24rpx;
  195. top: -45rpx;
  196. &:before{
  197. content: "";
  198. width: 25rpx;
  199. height: 25rpx;
  200. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  201. position: absolute;
  202. bottom: -8rpx;
  203. right: 30rpx;
  204. z-index: -1;
  205. transform:rotate(45deg);
  206. }
  207. }
  208. }
  209. .btn-cancel{
  210. background:#FFFFFF;
  211. color: #666666;
  212. float: left;
  213. // margin: 22rpx 0;
  214. margin-right: 15rpx;
  215. border: 2rpx solid #999999;
  216. }
  217. .btn-delete{
  218. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  219. }
  220. .btn-query{
  221. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  222. }
  223. .btn-confirm{
  224. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  225. }
  226. .btn-share{
  227. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  228. margin-right: 0;
  229. position: relative;
  230. .tips{
  231. width: 160rpx;
  232. height: 34rpx;
  233. padding: 10rpx 10rpx;
  234. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  235. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  236. border-radius: 8rpx;
  237. position: absolute;
  238. color: #FFFFFF;
  239. line-height: 34rpx;
  240. font-size: $font-size-24;
  241. text-align: left;
  242. right: 0;
  243. top: -65rpx;
  244. &:before{
  245. content: "";
  246. width: 25rpx;
  247. height: 25rpx;
  248. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  249. position: absolute;
  250. bottom: -8rpx;
  251. right: 30rpx;
  252. z-index: -1;
  253. transform:rotate(45deg);
  254. }
  255. }
  256. }
  257. }
  258. }
  259. </style>