hs.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <view class="app-content">
  3. <view class="billing_box_bg">
  4. <view class="input-wrap" >
  5. <view style="padding:0upx 0upx 0upx 0upx;margin-right:15upx;" >
  6. <button class="admin-button-com middle blue" @click="selectFlowerNumFn()">图片分类</button>
  7. </view>
  8. <view class="search-bar">
  9. <app-search-module ref="globalSearchRef" v-model="globalPy" placeholder="这里搜索" @input="globalSearch" />
  10. </view>
  11. <view style="float:right;margin-left:15upx;">
  12. <button class="admin-button-com middle blue" @click="goItem()" style="margin-right:10upx;">花材</button>
  13. <button class="admin-button-com middle blue" @click="removeFromSave(option.customId)">清空购物车</button>
  14. </view>
  15. </view>
  16. <button class="admin-button-com middle blue" @click="confirmToSave" style="position: absolute;top:120upx;right:24upx;z-index:99;">选好了</button>
  17. <view class="scroll-middle_bx">
  18. <scroll-view scroll-y scroll-with-animation class="tab-view">
  19. <!--分类-->
  20. <div v-for="(item, index) in globalClassData" :key="index" class="tab-bar-item" :class="globalClassIndex == index ? 'active' : ''" :data-current="index" @tap.stop="globalSwitchClass(index,item)">
  21. <text style="text-align: center;">{{ item.categoryName || "" }}</text>
  22. </div>
  23. <view style="height: 120upx"></view>
  24. </scroll-view>
  25. <scroll-view scroll-y class="right-box" :scroll-top="globalScrollTopPlace" @scroll="globalGetScroll"
  26. :scroll-into-view="scroll_into_view" scroll-with-animation="true" lower-threshold="100" @scrolltolower="globalScrollBottom">
  27. <!--花材列表-->
  28. <block v-if="!$util.isEmpty(globalItemData)">
  29. <view class="item_list_bx selectAll">
  30. <view v-if="!$util.isEmpty(globalItemData)">
  31. <template v-for="(productItem) in globalItemData">
  32. <view class="item_list_title" v-if="productItem.className && productItem.className!=''">{{ productItem.className }}</view>
  33. <view style="height: 175upx">
  34. <Commondity
  35. :globalCheckStock="true"
  36. :selectJobType="selectJobType"
  37. :info="productItem"
  38. @showAddModelFn="showAddModelFn"
  39. @replaceItemFn="replaceItemFn"
  40. @delProduct="delProduct"
  41. ></Commondity>
  42. </view>
  43. </template>
  44. </view>
  45. <view v-else>
  46. <view style="height:260upx;text-align:center;color:#CCCCCC;position: relative;">
  47. <view style="position: absolute;margin:auto;top:130upx;left:0;right:0;bottom:0;">暂无花材</view>
  48. </view>
  49. </view>
  50. </view>
  51. </block>
  52. <block v-else>
  53. <app-wrapper-empty title="加载中" :is-empty="$util.isEmpty(globalItemData)" />
  54. </block>
  55. </scroll-view>
  56. </view>
  57. <modal-module :show="isAddModel" @cancel="addItemModelHidden" @click="confirmAddItemModel" :title="customData.name" color="#333" :size="32" padding="30rpx 30rpx" >
  58. <template slot="customContent">
  59. <view class="select-cmd_bx" v-if="customData">
  60. <view class="kc">
  61. <text>库存 {{ customData.stock?parseFloat(customData.stock):0 }}</text>
  62. <text style="margin-left:14upx;" v-if="customData.priceType == 1">¥{{ parseFloat(customData.price) }}</text>
  63. <text style="margin-left:14upx;" v-else>--</text>
  64. </view>
  65. <view class="num_bx">
  66. <input style="width:280upx" v-model="customData.userPrice" @focus="customData.userPrice = null" :class="[Number(customData.cost) > Number(customData.userPrice) ? 'warning-price' : '']"
  67. :disabled="false" type="digit" placeholder="单价" />
  68. <text style="font-size:35upx;font-weight:bold;color:#666666;">元</text>
  69. </view>
  70. <view class="num_bx">
  71. <!-- #ifdef APP-PLUS -->
  72. <input style="width: 280upx" v-model="customData.bigCount" v-if="globalUnitType == 0" type="number" />
  73. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 0">份</text>
  74. <input style="width: 280upx" v-model="customData.smallCount" v-if="globalUnitType == 1" type="number" />
  75. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 1">{{customData.smallUnit}}</text>
  76. <!-- #endif -->
  77. <!-- #ifdef MP-WEIXIN -->
  78. <input style="width: 280upx" v-model="customData.bigCount" v-if="globalUnitType == 0" :focus="isAddInputFocus" type="number" />
  79. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 0">份</text>
  80. <input style="width: 280upx" v-model="customData.smallCount" v-if="globalUnitType == 1" :focus="isAddInputFocus" type="number" />
  81. <text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 1">{{customData.smallUnit}}</text>
  82. <!-- #endif -->
  83. </view>
  84. <view class="num_bx">
  85. <input style="width: 280upx;height:40upx;font-size:25upx;" v-model="customData.remark" type="text" placeholder="备注" />
  86. </view>
  87. </view>
  88. </template>
  89. </modal-module>
  90. <footer-cart :price="allPrice" :count="allCount" @confirm="confirmToSave" ></footer-cart>
  91. <uni-popup ref="globalClassImgRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
  92. <view style="display:flex;padding:20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
  93. <view v-for="(item, index) in globalClassData" :key="index" @tap.stop="globalChangeClass(index,item)" style="margin-bottom:20upx;margin-left:3upx;">
  94. <image :src="item.cover" style="width:120upx;height:120upx;border-radius:10upx;"></image>
  95. <view style="margin-top:5upx;overflow: hidden;white-space: nowrap;width:120upx;text-align:center;">{{item.name}}</view>
  96. </view>
  97. </view>
  98. </uni-popup>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. import AppSearchModule from "@/components/module/app-search";
  104. import AppTabs from "@/components/plugin/tabs";
  105. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  106. import Commondity from "./components/app-commodity2";
  107. import FooterCart from "@/components/module/app-footer-cart";
  108. import ModalModule from "@/components/plugin/modal";
  109. import { COMMODITY_TYPE } from "@/utils/declare";
  110. import hsMins from "@/mixins/hs";
  111. import { mapGetters } from "vuex";
  112. export default {
  113. name: "hs",
  114. components: {
  115. AppTabs,
  116. AppSearchModule,
  117. AppWrapperEmpty,
  118. Commondity,
  119. ModalModule,
  120. FooterCart,
  121. },
  122. mixins: [hsMins],
  123. data() {
  124. return {
  125. COMMODITY_TYPE,
  126. isSmallCount:false,
  127. globalCheckStock:true,
  128. autoLoad: false,
  129. xjData:{},
  130. xjDataInfo:{},
  131. };
  132. },
  133. computed: {
  134. ...mapGetters(["getLoginInfo"]),
  135. },
  136. onShow() {
  137. },
  138. onLoad () {
  139. if(this.option.customName){
  140. uni.setNavigationBarTitle({ title: this.option.customName })
  141. }
  142. if (this.option.customId){
  143. this.selectJobId = this.option.customId
  144. this.globalCustomId = this.option.customId
  145. }
  146. let book = this.option.book ? this.option.book : 0
  147. let getAll = this.option.getAll ? this.option.getAll : 0
  148. if(book == 0){
  149. this.globalRequestType = 'kd'
  150. this.initData()
  151. }else{
  152. this.globalCheckStock = false
  153. if(getAll == 1){
  154. this.globalRequestType = 'book'
  155. }else{
  156. this.globalRequestType = 'kd'
  157. }
  158. this.globalRequestType = 'book'
  159. this.initData()
  160. }
  161. },
  162. methods: {
  163. selectFlowerNumFn(){
  164. this.$msg('开发中')
  165. return false
  166. this.$refs.globalClassImgRef.open('top')
  167. },
  168. confirmToSave() {
  169. if(this.$util.isEmpty(this.selectList)){
  170. this.$msg('请选择花材')
  171. return false
  172. }
  173. if (this.$util.isEmpty(this.option.customId)){
  174. this.$msg("请选择客户")
  175. return
  176. }
  177. let customName = this.option.customName ? this.option.customName : '';
  178. let orderId = this.option.orderId ? this.option.orderId : 0
  179. let book = this.option.book ? this.option.book : 0
  180. let customId = this.option.customId?this.option.customId:0
  181. let reduceStock = this.option.reduceStock?this.option.reduceStock:0
  182. this.$util.pageTo({ url: '/admin/billing/affirm?customId='+customId+'&customName='+customName+'&orderId='+orderId+'&book='+book+'&reduceStock='+reduceStock+'&fromType=hs',type:2})
  183. },
  184. goItem(){
  185. let customName = this.option.customName ? this.option.customName : '';
  186. let orderId = this.option.orderId ? this.option.orderId : 0
  187. let book = this.option.book ? this.option.book : 0
  188. let customId = this.option.customId?this.option.customId:0
  189. let reduceStock = this.option.reduceStock?this.option.reduceStock:0
  190. this.$util.pageTo({url:'/admin/billing/index2?customId='+customId+'&customName='+customName+'&orderId='+orderId+'&book='+book+'&reduceStock='+reduceStock,type:2})
  191. }
  192. }
  193. };
  194. </script>
  195. <style lang="scss" scoped>
  196. .billing_box_bg {
  197. background: white;
  198. height: 100%;
  199. display: flex;
  200. flex-direction: column;
  201. .input-wrap {
  202. display: flex;
  203. padding: 22upx 20upx 22upx 13upx;
  204. .search-bar {
  205. flex: 1;
  206. }
  207. }
  208. .scroll-middle_bx {
  209. flex: 1;
  210. display: flex;
  211. width: 100%;
  212. height: 100%;
  213. overflow: hidden;
  214. }
  215. .tab-view {
  216. position: relative;
  217. height: calc(100vh - 140upx);
  218. width: 170upx;
  219. flex-shrink: 0;
  220. background-color: #f0f2f6;
  221. .tab-bar-item {
  222. position: relative;
  223. width: 170upx;
  224. height: 90upx;
  225. box-sizing: border-box;
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. font-size: 26upx;
  230. color: #444;
  231. font-weight: 400;
  232. .tag {
  233. display: flex;
  234. padding: 0 20upx;
  235. align-items: center;
  236. position: absolute;
  237. right: 0;
  238. top: 0;
  239. height: 32upx;
  240. background: #ff2842;
  241. border-radius: 16upx;
  242. color: #fff;
  243. font-size: 20upx;
  244. }
  245. &:last-child{
  246. margin-bottom: 110upx;
  247. }
  248. }
  249. .active {
  250. position: relative;
  251. color: $mainColor;
  252. font-size: 26upx;
  253. background: #fff;
  254. }
  255. .active::before {
  256. content: "";
  257. position: absolute;
  258. border-left: 8upx solid $mainColor;
  259. height: 100%;
  260. left: 0;
  261. }
  262. }
  263. .right-box {
  264. height: calc(100vh - 140upx);
  265. flex: 1;
  266. box-sizing: border-box;
  267. }
  268. .item_list_bx {
  269. padding: 40upx 16upx;
  270. //padding: 0 16upx;
  271. &:last-child{
  272. margin-bottom: 70upx;
  273. }
  274. }
  275. .item_list_title {
  276. margin-bottom: 20upx;
  277. font-size: 24upx;
  278. font-weight: 600;
  279. color: #666666;
  280. }
  281. .select-cmd_bx {
  282. & .kc {
  283. color: #999999;
  284. font-size: 28upx;
  285. font-weight: 400;
  286. margin-bottom: 40upx;
  287. text-align: center;
  288. margin-top: 30upx;
  289. .unit_price{
  290. padding-right:25upx;
  291. }
  292. }
  293. & .num_bx {
  294. display: flex;
  295. align-items: center;
  296. margin-bottom: 40upx;
  297. padding-left:110upx;
  298. & > input {
  299. width: 212upx;
  300. height: 80upx;
  301. border: 1upx solid #dddddd;
  302. border-radius: 4upx;
  303. text-align: center;
  304. margin-right: 24upx;
  305. font-size: 40upx;
  306. }
  307. }
  308. }
  309. }
  310. .class-popup-style{
  311. z-index:999999;
  312. }
  313. .warning-price{
  314. color:red;
  315. font-weight:bold;
  316. }
  317. </style>