commodityDetails.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <view style="padding-top: 0.01rpx;">
  3. <view style="width: 100%;margin: 0 auto;height: 800rpx;">
  4. <!-- <image v-for="(ite,ind) in form.filesList" :key="ind" v-if="ite.version === '0'" :src="ite.url" style="width: 100%;height: 100%;border-radius: 20rpx;"></image> -->
  5. <u-swiper :list="form.filesList" indicator indicatorMode="dot" :autoplay="false" height="800rpx"
  6. @click="swiperclick" imgMode="aspectFit"></u-swiper>
  7. </view>
  8. <view class="contentBox" v-if="Number(form.inventory) > 0">
  9. <view style="display: flex;align-items: center;">
  10. <view>
  11. <text style="font-size: 58rpx;color: red;margin-right: 20rpx;">¥{{ checkStatus == '通过' ? form.mallPrice
  12. || 0 :'***'}}</text>
  13. <!-- <text style="font-size: 48rpx;text-decoration:line-through;">¥{{form.standardPrice}}</text> -->
  14. </view>
  15. <view style="display: flex;">
  16. <view v-if="form.billType == 0"
  17. style="font-size: 16rpx;background-color: #FD4B09;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  18. 小时达</view>
  19. <view v-else
  20. style="font-size: 16rpx;background-color: #5ac725;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  21. 次日达</view>
  22. </view>
  23. </view>
  24. <view>
  25. <text>{{ form.cname }}</text>
  26. </view>
  27. </view>
  28. <view class="contentBox" v-if="Number(form.inventory) == 0" style="color:#909399;">
  29. <view style="display: flex;align-items: center;">
  30. <view>
  31. <text style="font-size: 58rpx;color:#909399;margin-right: 20rpx;">¥{{ checkStatus ==
  32. '通过' ? form.mallPrice || 0 :'***'}}</text>
  33. <!-- <text style="font-size: 48rpx;text-decoration:line-through;">¥{{form.standardPrice}}</text> -->
  34. </view>
  35. <view style="display: flex;">
  36. <view v-if="form.billType == 0"
  37. style="font-size: 16rpx;background-color: #909399;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  38. 小时达</view>
  39. <view v-else
  40. style="font-size: 16rpx;background-color: #909399;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  41. 次日达</view>
  42. </view>
  43. </view>
  44. <view>
  45. <text>{{ form.cname }}</text>
  46. </view>
  47. </view>
  48. <view class="head" v-if="Number(form.inventory) > 0">
  49. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false">
  50. <u-cell :isLink="false" :border="false" center>
  51. <template slot="title">
  52. <view style="display: flex;">
  53. <u-radio-group v-model="inventoryDataForm.storeInventory">
  54. <u-radio :activeColor="inventoryDataForm.storeInventory>0?'#FD4B09':'#909399'"
  55. v-if="inventoryDataForm.storeInventory"
  56. :label="`小时达(${~~(inventoryDataForm.storeInventory) > 10 ? '充足' : ~~(inventoryDataForm.storeInventory)})`"
  57. :name="inventoryDataForm.storeInventory"></u-radio>
  58. </u-radio-group>
  59. <u-radio-group v-model="inventoryDataForm.storeInventoryShare">
  60. <u-radio :activeColor="inventoryDataForm.storeInventoryShare>0?'#5ac725':'#909399'"
  61. v-if="inventoryDataForm.storeInventoryShare"
  62. :label="`次日达(${~~(inventoryDataForm.storeInventoryShare) > 10 ? '充足' : ~~(inventoryDataForm.storeInventoryShare)})`"
  63. :name="inventoryDataForm.storeInventoryShare"></u-radio>
  64. </u-radio-group>
  65. </view>
  66. </template>
  67. <template slot="value">
  68. <view>
  69. <u-icon :name="inventoryFalse ? 'arrow-up' : 'arrow-down'"
  70. @click="inventoryFalsefun()"></u-icon>
  71. </view>
  72. </template>
  73. </u-cell>
  74. </u-cell-group>
  75. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false">
  76. <!-- <u-cell title="所属公司:" :isLink="true" :border="false" center
  77. @click="filterAll(['salesCompanyName','salesCompanyId'])">
  78. <template slot="value">
  79. <text>{{form.salesCompanyName}}</text>
  80. </template>
  81. </u-cell> -->
  82. <u-cell :isLink="false" :border="false" center>
  83. <template slot="title">
  84. <!-- 一种利用符号进行的类型转换,转换成数字类型 -->
  85. <text>库存:{{ form.inventory ? ~~(form.inventory) > 10 ? '充足' : ~~(form.inventory) : '' }}</text>
  86. </template>
  87. <template slot="value">
  88. <u-number-box v-model="form.goodsNum" :min="1" :max="form.inventory"></u-number-box>
  89. </template>
  90. </u-cell>
  91. </u-cell-group>
  92. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false" v-if="inventoryFalse">
  93. <u-cell v-for="(item, index) in inventoryData" :key="index" titleStyle="color:#fd4b09;font-weight: 600;"
  94. :title="item.storageName"
  95. :value="Number(item.storeInventory) > 10 ? '充足' : Number(item.storeInventory)"></u-cell>
  96. </u-cell-group>
  97. </view>
  98. <view class="head" v-if="Number(form.inventory) == 0">
  99. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false">
  100. <u-cell :isLink="false" :border="false" center>
  101. <template slot="title">
  102. <view style="display: flex;">
  103. <u-radio-group v-model="inventoryDataForm.storeInventory">
  104. <u-radio activeColor="#909399" v-if="inventoryDataForm.storeInventory"
  105. :label="`小时达(${~~(inventoryDataForm.storeInventory) > 10 ? '充足' : ~~(inventoryDataForm.storeInventory)})`"
  106. :name="inventoryDataForm.storeInventory"></u-radio>
  107. </u-radio-group>
  108. <u-radio-group v-model="inventoryDataForm.storeInventoryShare">
  109. <u-radio activeColor="#909399" v-if="inventoryDataForm.storeInventoryShare"
  110. :label="`次日达(${~~(inventoryDataForm.storeInventoryShare) > 10 ? '充足' : ~~(inventoryDataForm.storeInventoryShare)})`"
  111. :name="inventoryDataForm.storeInventoryShare"></u-radio>
  112. </u-radio-group>
  113. </view>
  114. </template>
  115. <template slot="value">
  116. <view>
  117. <u-icon :name="inventoryFalse ? 'arrow-up' : 'arrow-down'"
  118. @click="inventoryFalsefun()"></u-icon>
  119. </view>
  120. </template>
  121. </u-cell>
  122. </u-cell-group>
  123. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false">
  124. <!-- <u-cell title="所属公司:" :isLink="true" :border="false" center
  125. @click="filterAll(['salesCompanyName','salesCompanyId'])">
  126. <template slot="value">
  127. <text>{{form.salesCompanyName}}</text>
  128. </template>
  129. </u-cell> -->
  130. <u-cell :isLink="false" :border="false" center>
  131. <template slot="title">
  132. <!-- 一种利用符号进行的类型转换,转换成数字类型 -->
  133. <text style="color: #909399;">库存:{{ form.inventory ? ~~(form.inventory) >
  134. 10 ? '充足' : ~~(form.inventory) :''}}</text>
  135. </template>
  136. <template slot="value">
  137. <u-number-box v-model="form.goodsNum" :min="1" :max="form.inventory"></u-number-box>
  138. </template>
  139. </u-cell>
  140. </u-cell-group>
  141. <u-cell-group title-bg-color="#909399" :border="false" v-if="inventoryFalse">
  142. <u-cell v-for="(item, index) in inventoryData" :key="index" titleStyle="color:#909399;font-weight: 600;"
  143. :title="item.storageName"
  144. :value="Number(item.storeInventory) > 10 ? '充足' : Number(item.storeInventory)"></u-cell>
  145. </u-cell-group>
  146. </view>
  147. <view class="head">
  148. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false" v-if="arrow">
  149. <u-cell :isLink="false" :border="false" center>
  150. <template slot="title">
  151. <text>规格型号:</text>
  152. </template>
  153. <template slot="value">
  154. <text>{{ form.specificationAndModel || '' }}</text>
  155. </template>
  156. </u-cell>
  157. <u-cell :isLink="false" :border="false" center>
  158. <template slot="title">
  159. <text>花纹:</text>
  160. </template>
  161. <template slot="value">
  162. <text>{{ form.brandItem || '' }}</text>
  163. </template>
  164. </u-cell>
  165. <u-cell :isLink="false" :border="false" center>
  166. <template slot="title">
  167. <text>产地:{{ form.placeProduction || '' }}</text>
  168. </template>
  169. <template slot="value">
  170. <text>防爆:{{ form.explosionProof == 1 ? "是" : "否" }}</text>
  171. </template>
  172. </u-cell>
  173. <u-cell :isLink="false" :border="false" center>
  174. <template slot="title">
  175. <text>原厂:{{ form.originalFactory == 1 ? '是' : '否' }}</text>
  176. </template>
  177. <template slot="value">
  178. <text>自修补:{{ form.selfRecovery == 1 ? '是' : '否' }}</text>
  179. </template>
  180. </u-cell>
  181. <u-cell :isLink="false" :border="false" center>
  182. <template slot="title">
  183. <text>商品描述:{{ form.detailsText ? form.detailsText : '-' }}</text>
  184. </template>
  185. </u-cell>
  186. </u-cell-group>
  187. <view style="margin: 0 auto;" @click="arrow = !arrow">
  188. <u-icon name="arrow-up" labelPos="top" size="28" v-if="arrow"></u-icon>
  189. <u-icon name="arrow-down" labelPos="top" size="28" v-else></u-icon>
  190. </view>
  191. </view>
  192. <u-divider text="商品详情"></u-divider>
  193. <view style="width: 100%;margin-bottom: 100rpx;">
  194. <view v-html="form.detailsText"></view>
  195. </view>
  196. <view
  197. style="width: 100%;position: fixed;bottom: 0;background-color: #fff;border-top: 1rpx solid #ccc;padding-bottom: env(safe-area-inset-bottom);">
  198. <view style="width: 100%;display: flex;font-size: 24rpx;">
  199. <view @click="shoppingCart"
  200. style="width: 50%;display: grid;justify-items: center;padding: 10rpx 0;border-right: 1rpx solid #ccc;">
  201. <u-icon name="shopping-cart"></u-icon>
  202. <view>购物车</view>
  203. </view>
  204. <view @click="placeAnOrder" v-if="form.inventory > 0"
  205. style="width: 50%;background-color: #fd4b09;display: grid;justify-items: center;">
  206. <u-icon name="checkmark" color="#fff"></u-icon>
  207. <view style="color: #fff;">加入购物车</view>
  208. </view>
  209. <view @click="soldOut" v-else
  210. style="width: 50%;background-color: #969696;display: grid;justify-items: center;">
  211. <u-icon name="close" color="#fff"></u-icon>
  212. <view style="color: #fff;">已售罄</view>
  213. </view>
  214. </view>
  215. </view>
  216. <u-picker :show="showWarehouse" :columns="columns" :keyName="keyName" @confirm="confirmWarehouse"
  217. @cancel="showWarehouse = false"></u-picker>
  218. <!-- 提取去登录 -->
  219. <u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!' @confirm="adminConfirm"
  220. @cancel="adminShow = false"></u-modal>
  221. </view>
  222. </template>
  223. <script>
  224. import {
  225. appDetail,
  226. appDetailNew,
  227. addToCart,
  228. appModifyPrice,
  229. stockDescList,
  230. stockDescListV1,
  231. listShareV1,
  232. isProcurement
  233. } from '@/api/tabBar/homeNew.js'
  234. export default {
  235. data() {
  236. return {
  237. inventoryDataForm: {},
  238. checkboxValue: [],
  239. form: {
  240. shareList: []
  241. },
  242. arrow: true,
  243. dataList: [],
  244. screen: {},
  245. columns: [],
  246. keyName: '',
  247. showWarehouse: false,
  248. dataForm: {
  249. thisLocality: {},
  250. offsite: {}
  251. },
  252. inventoryFalse: true,
  253. inventoryData: [],
  254. // 审核状态
  255. checkStatus: '',
  256. adminShow: false,
  257. }
  258. },
  259. onLoad(onLoad) {
  260. this.checkStatus = uni.getStorageSync('checkStatus');
  261. if (uni.getStorageSync('whether_openShare') == 1) {
  262. appDetailNew(onLoad).then(res => {
  263. this.dataForm = res.data
  264. if (res.data.type == 0) {
  265. this.form = res.data.thisLocality
  266. } else {
  267. this.form = res.data.offsite
  268. }
  269. this.form.goodsNum = Number(this.form.goodsNum)
  270. this.stockDescListfun()
  271. })
  272. } else {
  273. appDetail(onLoad).then(res => {
  274. this.dataForm = res.data
  275. if (res.data.type == 0) {
  276. this.form = res.data.thisLocality
  277. } else {
  278. this.form = res.data.offsite
  279. }
  280. this.form.goodsNum = Number(this.form.goodsNum)
  281. this.stockDescListfun()
  282. })
  283. }
  284. },
  285. methods: {
  286. // admin确认
  287. adminConfirm() {
  288. uni.clearStorageSync();
  289. uni.redirectTo({
  290. url: '/pages/login/login'
  291. })
  292. },
  293. // 轮播图点击预览
  294. swiperclick(e) {
  295. let arr = this.form.filesList.map(item => {
  296. return item.url
  297. })
  298. uni.previewImage({
  299. count: arr[e],
  300. current: e,
  301. urls: arr
  302. })
  303. },
  304. inventoryFalsefun() {
  305. this.inventoryFalse = !this.inventoryFalse
  306. this.stockDescListfun()
  307. },
  308. // 库存查询
  309. stockDescListfun() {
  310. listShareV1({
  311. code: uni.getStorageSync('whether_openShare') == 1 ? this.form.goodsCode : this.form.code,
  312. whether: 0
  313. }).then(res => {
  314. this.inventoryDataForm = res.data
  315. })
  316. stockDescListV1({
  317. cname: this.form.cname,
  318. whether: 0
  319. }).then(res => {
  320. this.inventoryData = res.data.records
  321. })
  322. },
  323. soldOut() {
  324. uni.showToast({
  325. icon: "none",
  326. title: '商品已售罄',
  327. mask: true
  328. });
  329. },
  330. backToHome() {
  331. uni.$u.route({
  332. url: 'pages/tabBar/home',
  333. type: "switchTab"
  334. })
  335. },
  336. // 加入购物车
  337. placeAnOrder() {
  338. if (uni.getStorageSync('userInfo').tenant_id == '000000') {
  339. this.adminShow = true
  340. return
  341. }
  342. uni.showLoading({
  343. title: '加载中',
  344. mask: true
  345. });
  346. addToCart({
  347. ...this.form,
  348. whetherIntegral: '0',
  349. detailsText: ''
  350. }).then(res => {
  351. uni.hideLoading();
  352. uni.showToast({
  353. title: "加入购物车成功",
  354. icon: "none",
  355. });
  356. }).catch(err => {
  357. uni.hideLoading();
  358. })
  359. },
  360. filterAll(screen) {
  361. this.screen = screen
  362. switch (screen[1]) {
  363. case "salesCompanyId":
  364. this.columns = [this.form.shareList]
  365. this.keyName = screen[1]
  366. this.showWarehouse = true
  367. break
  368. }
  369. },
  370. confirmWarehouse(e) {
  371. appModifyPrice({
  372. id: e.value[0].id
  373. }).then(res => {
  374. this.form.salesCompanyName = e.value[0].salesCompanyName
  375. this.form.salesCompanyId = e.value[0].salesCompanyId
  376. this.form.mallPrice = res.data.mallPrice
  377. this.form.inventory = res.data.inventory
  378. this.showWarehouse = false
  379. })
  380. },
  381. shoppingCart() {
  382. uni.$u.route({
  383. url: 'pages/tabBar/shoppingCart',
  384. type: "switchTab"
  385. })
  386. }
  387. }
  388. }
  389. </script>
  390. <style scoped>
  391. /* page {
  392. background-color: #f2f2f2 !important;
  393. } */
  394. .head {
  395. width: calc(96% - 40rpx);
  396. margin: 0 auto;
  397. background-color: #FFFFFF;
  398. margin-top: 20rpx;
  399. border-radius: 20rpx;
  400. padding: 10rpx 20rpx 10rpx 20rpx;
  401. }
  402. .contentBox {
  403. width: 96%;
  404. margin: 20rpx auto;
  405. background-color: #FFFFFF;
  406. border-radius: 20rpx;
  407. /* box-shadow: 0 5rpx 14rpx 0 rgba(101, 176, 249, 0.42); */
  408. padding-top: 15rpx;
  409. padding-bottom: 10rpx;
  410. }
  411. .textBox {
  412. padding: 0 15px;
  413. display: flex;
  414. justify-content: space-between;
  415. font-size: 24rpx;
  416. margin-bottom: 10rpx;
  417. align-items: flex-end;
  418. }
  419. </style>