leftGroup.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="itemList-box">
  3. <view class="title">
  4. 列表
  5. <text style="float:right;">{{ getMyShopInfo.shopName=='首店'? getMyShopInfo.merchantName: getMyShopInfo.merchantName+' '+getMyShopInfo.shopName}}</text>
  6. </view>
  7. <scroll-view class="itemList-item_box" scroll-y="true" @scrolltolower="reachBottom" lower-threshold="50">
  8. <view v-for="item in list.data" :key="item.id" class="show-item_box">
  9. <view class="item-body_box not-active" @click="getDetail(item)">
  10. <view class="flower-name_box">
  11. <view class="current-item-title">
  12. <text class="name">{{item.name}}</text>
  13. </view>
  14. <image class="flower-image" :src="item.cover"></image>
  15. </view>
  16. <view class="item-price-num"> <view>¥{{parseFloat(item.price)}}</view> <view>{{item.num}}次</view> <view>快捷开单</view> <view><text @click.stop="delCombination(item.id)" class="del">删除</text></view> </view>
  17. </view>
  18. </view>
  19. </scroll-view>
  20. <!-- 结算弹框 -->
  21. <uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
  22. <settlePop @settleCommit="settleCommit" @cancelSettle="cancelSettle" ref="settlePop" :groupInfo.sync="groupInfo" :settleOpenStatus.sync="settleOpenStatus" :custom.sync="custom"></settlePop>
  23. </uni-popup>
  24. <!-- 扫码付款 -->
  25. <uni-popup ref="toPayRef" background-color="#fff" type="center" :animation="false" :is-mask-click="false">
  26. <toPayWay @cancelPay="cancelPay()" @closePay="closeToPay()" @payFinish="payFinish()" @selectPayWayBack="selectPayWayBack" :orderId.sync="orderId" :price.sync="price"></toPayWay>
  27. </uni-popup>
  28. </view>
  29. </template>
  30. <script>
  31. import { mapGetters } from "vuex";
  32. import settlePop from './settlePop'
  33. import toPayWay from './toPay'
  34. import { list } from "@/mixins"
  35. import { createOrder} from '@/api/order'
  36. import productMins from "@/mixins/product"
  37. export default {
  38. name:'leftItem',
  39. components:{settlePop,toPayWay},
  40. mixins: [list,productMins],
  41. props: {
  42. customId: {
  43. type: Number,
  44. default: 0
  45. }
  46. },
  47. data(){
  48. return {
  49. totalShop:{ bigUnit: 0, smallUnit:0, totalPrice: 0 },
  50. itemList:[],
  51. currentJobType:'bill',
  52. currentJobId:0,
  53. groupList:[],
  54. settleOpenStatus:0,
  55. groupInfo:{},
  56. orderId:0,
  57. price:0,
  58. custom:{}
  59. }
  60. },
  61. computed:{
  62. ...mapGetters(["getMyShopInfo"]),
  63. },
  64. watch:{
  65. customId:{
  66. handler(newCustomId){
  67. this.currentJobId = newCustomId
  68. },
  69. immediate:true
  70. },
  71. custom:{
  72. handler(newCustom){
  73. this.custom = newCustom
  74. },
  75. immediate:true
  76. }
  77. },
  78. created(){
  79. },
  80. methods:{
  81. payFinish(){
  82. this.$util.hitVoice()
  83. this.$refs.toPayRef.close()
  84. this.listenScanItem()
  85. },
  86. selectPayWayBack(){
  87. this.$util.hitVoice()
  88. },
  89. getDetail(item){
  90. },
  91. settleCommit(params){
  92. uni.showLoading({mask:true})
  93. createOrder({...params,groupId:this.groupInfo.id,isCashier:1}).then(res=>{
  94. uni.hideLoading()
  95. if(res.code == 1){
  96. if(res.data.status == 1){
  97. this.orderId = res.data.id
  98. this.price = res.data.mainPay ? Number(res.data.mainPay) : 0
  99. this.$refs.toPayRef.open('center')
  100. }
  101. this.settleOpenStatus = 0
  102. this.$refs.settlePopRef.close()
  103. }
  104. })
  105. },
  106. cancelPay(){
  107. this.$util.hitVoice()
  108. this.$refs.toPayRef.close()
  109. this.listenScanItem()
  110. },
  111. /** 仅关闭付款弹层,不取消订单 */
  112. closeToPay(){
  113. this.cancelPay()
  114. },
  115. reachBottom() {
  116. },
  117. cancelSettle(){
  118. this.$util.hitVoice()
  119. this.settleOpenStatus = 0
  120. this.$refs.settlePopRef.close()
  121. },
  122. delCombination(itemId){
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .itemList-box {
  129. height: 100%;
  130. display: flex;
  131. flex-direction: column;
  132. & .title {
  133. padding: 3upx;
  134. font-size: 12upx;
  135. background-color:#3385FF;
  136. color: #FFFFFF;
  137. }
  138. & .itemList-item_box {
  139. margin-bottom:75upx;
  140. overflow-y: auto;
  141. flex: 1;
  142. border: 1px solid #eee;
  143. & .show-item_box {
  144. padding: 2upx;
  145. & .item-body_box {
  146. border-radius: 2upx;
  147. padding: 2upx;
  148. font-size: 14upx;
  149. color:#666666;
  150. height:58upx;
  151. &.active {
  152. background-color: #d4d6d6;
  153. }
  154. &.not-active {
  155. background-color: #e7e9e9;
  156. }
  157. & .flower-name_box {
  158. padding: 0 5upx;
  159. position: relative;
  160. .current-item-title {
  161. .name{
  162. color: #333333;
  163. font-weight: bold;
  164. overflow: hidden;
  165. text-overflow:ellipsis;
  166. white-space: nowrap;
  167. width:60upx;
  168. font-size:11upx;
  169. }
  170. }
  171. .flower-image{
  172. position: absolute;
  173. right:1upx;
  174. top:1upx;
  175. width:32upx;
  176. height:32upx;
  177. border-radius:5upx;
  178. }
  179. }
  180. .item-price-num{
  181. color:#428369;
  182. font-size:10upx;
  183. display: flex;
  184. margin-top:5upx;
  185. align-items: center;
  186. justify-content: space-between;
  187. padding: 15upx 2upx 0 2upx;
  188. .del{
  189. color:orange;
  190. font-size:12upx;
  191. }
  192. }
  193. }
  194. }
  195. }
  196. & .itemList-footer_box {
  197. height: 20upx;
  198. border: 1px solid #eee;
  199. font-size: 10upx;
  200. display: flex;
  201. align-items: center;
  202. justify-content: space-around;
  203. }
  204. }
  205. </style>